jsDoc Typing

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2021 Sep 16 6:38
Editor
Edited
Edited
2025 Sep 30 17:39
Refs
Refs
  • @ts-check - first line of file
  • @ts-ignore - ignore next line error
  • @ts-expect-error - same with ignore but throw compiler error
  • @param - what this do
  • @type - type
    • @typedef - new type
    • @template - generic
    • @class - constructor function type intead of @constructor
    • @augments - extends manually for generic like instead of @extends
     
     
     

    Constructor Generic Extends

    JSDoc: document generic type that works for grandchildren classes
    Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question. Provide details and share your research! Asking for help, clarification, or responding to other answers. Making statements based on opinion; back them up with references or personal experience. To learn more, see our tips on writing great answers.
    JSDoc: document generic type that works for grandchildren classes
    Type Safe JavaScript with JSDoc
    JSDoc comments are an alternative to TypeScript and Flow for type definitions in JavaScript. In combination with VSCode you can get type checking and IntelliSense just like TypeScript.
    Type Safe JavaScript with JSDoc
    Type checking your JavaScript with VS Code - the superpowers you didn't know you had
    Follow me on Twitter, happy to take your suggestions on topics or improvements /Chris Ok so you've decided that pure JavaScript is enough for your project, don't want to adopt TypeScript just yet or ever and you are using VS Code? - Then this is for you.

    Type casting supported

    How to disable a ts rule for a specific line?
    TypeScript 3.9 introduces a new magic comment. @ts-expect-error will: have same functionality as trigger an error, if actually no compiler error has been suppressed (= indicates useless flag) if (false) { // @ts-expect-error: Let's ignore a compile error like this unreachable code console.log("hello"); // compiles } // If @ts-expect-error didn't suppress anything at all, we now get a nice warning let flag = true; // ...
    How to disable a ts rule for a specific line?
    Documentation - JSDoc Reference
    What JSDoc does TypeScript-powered JavaScript support?
     
     

    Recommendations