{"componentChunkName":"component---src-templates-documentation-tsx","path":"/docs/handbook/jsdoc-supported-types.html","result":{"data":{"allSitePage":{"nodes":[{"path":"/dev-404-page/"},{"path":"/docs/handbook/nightly-builds.html"},{"path":"/docs/handbook/declaration-files/by-example.html"},{"path":"/docs/handbook/declaration-files/consumption.html"},{"path":"/docs/handbook/declaration-files/deep-dive.html"},{"path":"/docs/handbook/declaration-files/do-s-and-don-ts.html"},{"path":"/docs/handbook/declaration-files/introduction.html"},{"path":"/docs/handbook/declaration-files/library-structures.html"},{"path":"/docs/handbook/declaration-files/publishing.html"},{"path":"/docs/handbook/declaration-files/templates.html"},{"path":"/docs/handbook/typescript-in-5-minutes-func.html"},{"path":"/docs/handbook/typescript-in-5-minutes.html"},{"path":"/docs/handbook/typescript-in-5-minutes-oop.html"},{"path":"/docs/handbook/typescript-from-scratch.html"},{"path":"/docs/handbook/basic-types.html"},{"path":"/docs/handbook/classes.html"},{"path":"/docs/handbook/enums.html"},{"path":"/docs/handbook/functions.html"},{"path":"/docs/handbook/generics.html"},{"path":"/docs/handbook/interfaces.html"},{"path":"/docs/handbook/literal-types.html"},{"path":"/docs/handbook/intro.html"},{"path":"/docs/handbook/unions-and-intersections.html"},{"path":"/docs/handbook/declaration-files/dts-from-js.html"},{"path":"/docs/handbook/intro-to-js-ts.html"},{"path":"/docs/handbook/jsdoc-supported-types.html"},{"path":"/docs/handbook/type-checking-javascript-files.html"},{"path":"/docs/handbook/compiler-options-in-msbuild.html"},{"path":"/docs/handbook/compiler-options.html"},{"path":"/docs/handbook/configuring-watch.html"},{"path":"/docs/handbook/integrating-with-build-tools.html"},{"path":"/docs/handbook/project-references.html"},{"path":"/docs/handbook/tsconfig-json.html"},{"path":"/docs/handbook/advanced-types.html"},{"path":"/docs/handbook/declaration-merging.html"},{"path":"/docs/handbook/decorators.html"},{"path":"/docs/handbook/iterators-and-generators.html"},{"path":"/docs/handbook/jsx.html"},{"path":"/docs/handbook/mixins.html"},{"path":"/docs/handbook/module-resolution.html"},{"path":"/docs/handbook/modules.html"},{"path":"/docs/handbook/namespaces-and-modules.html"},{"path":"/docs/handbook/namespaces.html"},{"path":"/docs/handbook/symbols.html"},{"path":"/docs/handbook/triple-slash-directives.html"},{"path":"/docs/handbook/type-compatibility.html"},{"path":"/docs/handbook/type-inference.html"},{"path":"/docs/handbook/utility-types.html"},{"path":"/docs/handbook/variable-declarations.html"},{"path":"/docs/handbook/release-notes/typescript-1-1.html"},{"path":"/docs/handbook/release-notes/typescript-1-3.html"},{"path":"/docs/handbook/release-notes/typescript-1-4.html"},{"path":"/docs/handbook/release-notes/typescript-1-5.html"},{"path":"/docs/handbook/release-notes/typescript-1-6.html"},{"path":"/docs/handbook/release-notes/typescript-1-7.html"},{"path":"/docs/handbook/release-notes/typescript-1-8.html"},{"path":"/docs/handbook/release-notes/typescript-2-0.html"},{"path":"/docs/handbook/release-notes/typescript-2-1.html"},{"path":"/docs/handbook/release-notes/typescript-2-2.html"},{"path":"/docs/handbook/release-notes/typescript-2-3.html"},{"path":"/docs/handbook/release-notes/typescript-2-4.html"},{"path":"/docs/handbook/release-notes/typescript-2-5.html"},{"path":"/docs/handbook/release-notes/typescript-2-6.html"},{"path":"/docs/handbook/release-notes/typescript-2-7.html"},{"path":"/docs/handbook/release-notes/typescript-2-8.html"},{"path":"/docs/handbook/release-notes/typescript-2-9.html"},{"path":"/docs/handbook/release-notes/typescript-3-0.html"},{"path":"/docs/handbook/release-notes/typescript-3-1.html"},{"path":"/docs/handbook/release-notes/typescript-3-2.html"},{"path":"/docs/handbook/release-notes/typescript-3-3.html"},{"path":"/docs/handbook/release-notes/typescript-3-4.html"},{"path":"/docs/handbook/release-notes/typescript-3-5.html"},{"path":"/docs/handbook/release-notes/typescript-3-6.html"},{"path":"/docs/handbook/release-notes/typescript-3-7.html"},{"path":"/docs/handbook/release-notes/typescript-3-8.html"},{"path":"/docs/handbook/release-notes/typescript-3-9.html"},{"path":"/docs/handbook/asp-net-core.html"},{"path":"/docs/handbook/angular.html"},{"path":"/docs/handbook/babel-with-typescript.html"},{"path":"/docs/handbook/dom-manipulation.html"},{"path":"/docs/handbook/gulp.html"},{"path":"/docs/handbook/migrating-from-javascript.html"},{"path":"/docs/handbook/react.html"},{"path":"/docs/handbook/typescript-tooling-in-5-minutes.html"},{"path":"/vo/docs/handbook/basic-types.html"},{"path":"/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html"},{"path":"/docs/handbook/declaration-files/templates/global-plugin-d-ts.html"},{"path":"/docs/handbook/declaration-files/templates/global-d-ts.html"},{"path":"/docs/handbook/declaration-files/templates/module-class-d-ts.html"},{"path":"/docs/handbook/declaration-files/templates/module-function-d-ts.html"},{"path":"/docs/handbook/declaration-files/templates/module-plugin-d-ts.html"},{"path":"/docs/handbook/declaration-files/templates/module-d-ts.html"},{"path":"/docs/handbook/release-notes/overview.html"},{"path":"/tsconfig"},{"path":"/en/tsconfig"},{"path":"/vo/tsconfig"},{"path":"/ja/tsconfig"},{"path":"/pt/tsconfig"},{"path":"/play"},{"path":"/en/play"},{"path":"/es/play"},{"path":"/ja/play"},{"path":"/pt/play"},{"path":"/vo/play"},{"path":"/zh/play"},{"path":"/fa/play"},{"path":"/play/3-7/fixits/big-number-literals.ts"},{"path":"/play/3-7/fixits/const-to-let.ts"},{"path":"/play/3-7/fixits/infer-from-usage-changes.ts"},{"path":"/play/3-7/syntax-and-messaging/flattened-error-reporting.ts"},{"path":"/play/3-7/syntax-and-messaging/nullish-coalescing.ts"},{"path":"/play/3-7/syntax-and-messaging/optional-chaining.ts"},{"path":"/play/3-7/types-and-code-flow/assertion-functions.ts"},{"path":"/play/3-7/types-and-code-flow/recursive-type-references.ts"},{"path":"/play/3-7/types-and-code-flow/uncalled-function-checks.ts"},{"path":"/play/3-8/breaking-changes/checking-unions-with-index-signatures.ts"},{"path":"/play/3-8/jsdoc-improvements/accessibility-modifiers.js"},{"path":"/play/3-8/syntax-and-messaging/export-modules-from.ts"},{"path":"/play/3-8/syntax-and-messaging/private-class-fields.ts"},{"path":"/play/4-0/new-checks/class-constructor-code-flow.ts"},{"path":"/play/4-0/new-js-features/jsdoc-deprecated.ts"},{"path":"/play/4-0/new-js-features/logical-operators-and-assignment.ts"},{"path":"/play/4-0/new-js-features/nullish-coalescing.ts"},{"path":"/play/4-0/new-ts-features/named-tuples.ts"},{"path":"/play/4-0/new-ts-features/unknown-in-catch.ts"},{"path":"/play/4-0/new-ts-features/variadic-tuples.ts"},{"path":"/play/javascript/external-apis/typescript-with-deno.ts"},{"path":"/play/javascript/external-apis/typescript-with-node.js"},{"path":"/play/javascript/external-apis/typescript-with-web.js"},{"path":"/play/javascript/external-apis/typescript-with-webgl.js"},{"path":"/play/javascript/functions-with-javascript/function-chaining.ts"},{"path":"/play/javascript/functions-with-javascript/generic-functions.ts"},{"path":"/play/javascript/functions-with-javascript/typing-functions.ts"},{"path":"/play/javascript/helping-with-javascript/errors.ts"},{"path":"/play/javascript/helping-with-javascript/quick-fixes.ts"},{"path":"/play/javascript/javascript-essentials/code-flow.ts"},{"path":"/play/javascript/javascript-essentials/functions.ts"},{"path":"/play/javascript/javascript-essentials/hello-world.ts"},{"path":"/play/javascript/javascript-essentials/objects-and-arrays.ts"},{"path":"/play/javascript/modern-javascript/async-await.ts"},{"path":"/play/javascript/modern-javascript/immutability.ts"},{"path":"/play/javascript/modern-javascript/import-export.ts"},{"path":"/play/javascript/modern-javascript/jsdoc-support.js"},{"path":"/play/javascript/working-with-classes/classes-101.ts"},{"path":"/play/javascript/working-with-classes/generic-classes.ts"},{"path":"/play/javascript/working-with-classes/mixins.ts"},{"path":"/play/javascript/working-with-classes/this.ts"},{"path":"/play/playground/config/javascript-playgrounds.js"},{"path":"/play/playground/config/new-compiler-defaults.ts"},{"path":"/play/playground/language/automatic-type-acquisition.ts"},{"path":"/play/playground/language/fixits.ts"},{"path":"/play/playground/tooling/mobile-support.ts"},{"path":"/play/playground/tooling/sharable-urls.ts"},{"path":"/play/playground/tooling/typescript-versions.ts"},{"path":"/play/typescript/language/soundness.ts"},{"path":"/play/typescript/language/structural-typing.ts"},{"path":"/play/typescript/language/type-guards.ts"},{"path":"/play/typescript/language/type-widening-and-narrowing.ts"},{"path":"/play/typescript/language-extensions/enums.ts"},{"path":"/play/typescript/language-extensions/nominal-typing.ts"},{"path":"/play/typescript/language-extensions/types-vs-interfaces.ts"},{"path":"/play/typescript/meta-types/conditional-types.ts"},{"path":"/play/typescript/meta-types/discriminate-types.ts"},{"path":"/play/typescript/meta-types/indexed-types.ts"},{"path":"/play/typescript/meta-types/mapped-types.ts"},{"path":"/play/typescript/primitives/any.ts"},{"path":"/play/typescript/primitives/literals.ts"},{"path":"/play/typescript/primitives/union-and-intersection-types.ts"},{"path":"/play/typescript/primitives/unknown-and-never.ts"},{"path":"/play/typescript/type-primitives/built-in-utility-types.ts"},{"path":"/play/typescript/type-primitives/nullable-types.ts"},{"path":"/play/typescript/type-primitives/tuples.ts"},{"path":"/es/play/javascript/external-apis/typescript-with-deno.ts"},{"path":"/es/play/javascript/external-apis/typescript-with-node.js"},{"path":"/es/play/javascript/external-apis/typescript-with-web.js"},{"path":"/es/play/javascript/functions-with-javascript/function-chaining.ts"},{"path":"/es/play/javascript/functions-with-javascript/generic-functions.ts"},{"path":"/es/play/javascript/javascript-essentials/hello-world.ts"},{"path":"/es/play/javascript/javascript-essentials/objects-and-arrays.ts"},{"path":"/es/play/typescript/language/soundness.ts"},{"path":"/es/play/typescript/language/structural-typing.ts"},{"path":"/es/play/typescript/language/type-guards.ts"},{"path":"/es/play/typescript/language/type-widening-and-narrowing.ts"},{"path":"/es/play/typescript/meta-types/conditional-types.ts"},{"path":"/es/play/typescript/meta-types/discriminate-types.ts"},{"path":"/es/play/typescript/meta-types/indexed-types.ts"},{"path":"/es/play/typescript/meta-types/mapped-types.ts"},{"path":"/es/play/typescript/primitives/any.ts"},{"path":"/es/play/typescript/primitives/literals.ts"},{"path":"/es/play/typescript/primitives/union-and-intersection-types.ts"},{"path":"/es/play/typescript/primitives/unknown-and-never.ts"},{"path":"/es/play/typescript/type-primitives/built-in-utility-types.ts"},{"path":"/es/play/typescript/type-primitives/nullable-types.ts"},{"path":"/es/play/typescript/type-primitives/tuples.ts"},{"path":"/fa/play/javascript/javascript-essentials/hello-world.ts"},{"path":"/ja/play/3-7/fixits/big-number-literals.ts"},{"path":"/ja/play/3-7/syntax-and-messaging/nullish-coalescing.ts"},{"path":"/ja/play/3-7/syntax-and-messaging/optional-chaining.ts"},{"path":"/ja/play/3-8/breaking-changes/checking-unions-with-index-signatures.ts"},{"path":"/ja/play/javascript/external-apis/typescript-with-deno.ts"},{"path":"/ja/play/typescript/language-extensions/enums.ts"},{"path":"/ja/play/typescript/language-extensions/nominal-typing.ts"},{"path":"/ja/play/typescript/language-extensions/types-vs-interfaces.ts"},{"path":"/ja/play/typescript/primitives/any.ts"},{"path":"/ja/play/typescript/primitives/literals.ts"},{"path":"/ja/play/typescript/primitives/union-and-intersection-types.ts"},{"path":"/ja/play/typescript/primitives/unknown-and-never.ts"},{"path":"/ja/play/typescript/type-primitives/built-in-utility-types.ts"},{"path":"/ja/play/typescript/type-primitives/nullable-types.ts"},{"path":"/ja/play/typescript/type-primitives/tuples.ts"},{"path":"/pt/play/javascript/javascript-essentials/code-flow.ts"},{"path":"/pt/play/javascript/javascript-essentials/functions.ts"},{"path":"/pt/play/javascript/javascript-essentials/hello-world.ts"},{"path":"/pt/play/javascript/javascript-essentials/objects-and-arrays.ts"},{"path":"/vo/play/javascript/javascript-essentials/code-flow.ts"},{"path":"/vo/play/javascript/javascript-essentials/functions.ts"},{"path":"/vo/play/javascript/javascript-essentials/hello-world.ts"},{"path":"/vo/play/javascript/javascript-essentials/objects-and-arrays.ts"},{"path":"/zh/play/javascript/external-apis/typescript-with-deno.ts"},{"path":"/zh/play/javascript/external-apis/typescript-with-node.js"},{"path":"/zh/play/javascript/external-apis/typescript-with-web.js"},{"path":"/zh/play/javascript/external-apis/typescript-with-webgl.js"},{"path":"/zh/play/javascript/functions-with-javascript/function-chaining.ts"},{"path":"/zh/play/javascript/functions-with-javascript/generic-functions.ts"},{"path":"/zh/play/javascript/functions-with-javascript/typing-functions.ts"},{"path":"/zh/play/javascript/helping-with-javascript/errors.ts"},{"path":"/zh/play/javascript/helping-with-javascript/quick-fixes.ts"},{"path":"/zh/play/javascript/javascript-essentials/code-flow.ts"},{"path":"/zh/play/javascript/javascript-essentials/functions.ts"},{"path":"/zh/play/javascript/javascript-essentials/hello-world.ts"},{"path":"/zh/play/javascript/javascript-essentials/objects-and-arrays.ts"},{"path":"/zh/play/javascript/modern-javascript/async-await.ts"},{"path":"/zh/play/javascript/modern-javascript/immutability.ts"},{"path":"/zh/play/javascript/modern-javascript/import-export.ts"},{"path":"/zh/play/javascript/modern-javascript/jsdoc-support.js"},{"path":"/zh/play/javascript/working-with-classes/classes-101.ts"},{"path":"/zh/play/javascript/working-with-classes/generic-classes.ts"},{"path":"/zh/play/javascript/working-with-classes/mixins.ts"},{"path":"/zh/play/javascript/working-with-classes/this.ts"},{"path":"/zh/play/playground/config/javascript-playgrounds.js"},{"path":"/zh/play/playground/config/new-compiler-defaults.ts"},{"path":"/zh/play/playground/language/automatic-type-acquisition.ts"},{"path":"/zh/play/playground/language/fixits.ts"},{"path":"/zh/play/playground/tooling/mobile-support.ts"},{"path":"/zh/play/playground/tooling/sharable-urls.ts"},{"path":"/zh/play/playground/tooling/typescript-versions.ts"},{"path":"/zh/play/typescript/language/soundness.ts"},{"path":"/zh/play/typescript/language/structural-typing.ts"},{"path":"/zh/play/typescript/language/type-guards.ts"},{"path":"/zh/play/typescript/language/type-widening-and-narrowing.ts"},{"path":"/zh/play/typescript/language-extensions/enums.ts"},{"path":"/zh/play/typescript/language-extensions/nominal-typing.ts"},{"path":"/zh/play/typescript/language-extensions/types-vs-interfaces.ts"},{"path":"/zh/play/typescript/meta-types/conditional-types.ts"},{"path":"/zh/play/typescript/meta-types/discriminate-types.ts"},{"path":"/zh/play/typescript/meta-types/indexed-types.ts"},{"path":"/zh/play/typescript/meta-types/mapped-types.ts"},{"path":"/zh/play/typescript/primitives/any.ts"},{"path":"/zh/play/typescript/primitives/literals.ts"},{"path":"/zh/play/typescript/primitives/union-and-intersection-types.ts"},{"path":"/zh/play/typescript/primitives/unknown-and-never.ts"},{"path":"/zh/play/typescript/type-primitives/built-in-utility-types.ts"},{"path":"/zh/play/typescript/type-primitives/nullable-types.ts"},{"path":"/zh/play/typescript/type-primitives/tuples.ts"},{"path":"/ja/play/3-7/syntax-and-messaging/flattened-error-reporting.ts"},{"path":"/ja/play/3-7/fixits/infer-from-usage-changes.ts"},{"path":"/ja/play/3-7/fixits/const-to-let.ts"},{"path":"/community"},{"path":"/es/community"},{"path":"/ja/community"},{"path":"/vo/community"},{"path":"/zh/community"},{"path":"/download"},{"path":"/es/download"},{"path":"/ja/download"},{"path":"/vo/download"},{"path":"/zh/download"},{"path":"/empty"},{"path":"/es/empty"},{"path":"/ja/empty"},{"path":"/vo/empty"},{"path":"/zh/empty"},{"path":"/"},{"path":"/es/"},{"path":"/ja/"},{"path":"/vo/"},{"path":"/zh/"},{"path":"/tools"},{"path":"/es/tools"},{"path":"/ja/tools"},{"path":"/vo/tools"},{"path":"/zh/tools"},{"path":"/why-create-typescript"},{"path":"/es/why-create-typescript"},{"path":"/ja/why-create-typescript"},{"path":"/vo/why-create-typescript"},{"path":"/zh/why-create-typescript"},{"path":"/docs/bootstrap"},{"path":"/es/docs/bootstrap"},{"path":"/ja/docs/bootstrap"},{"path":"/vo/docs/bootstrap"},{"path":"/zh/docs/bootstrap"},{"path":"/docs/"},{"path":"/es/docs/"},{"path":"/ja/docs/"},{"path":"/vo/docs/"},{"path":"/zh/docs/"},{"path":"/docs/handbook/"},{"path":"/es/docs/handbook/"},{"path":"/ja/docs/handbook/"},{"path":"/vo/docs/handbook/"},{"path":"/zh/docs/handbook/"},{"path":"/branding/"},{"path":"/dev/bug-workbench/"},{"path":"/dev/playground-plugins/"},{"path":"/dev/sandbox/"},{"path":"/dev/twoslash/"},{"path":"/dev/typescript-vfs/"},{"path":"/upcoming/"}]},"markdownRemark":{"id":"43becf87-56f2-538e-84d9-ff420888039f","excerpt":"The list below outlines which constructs are currently supported\nwhen using JSDoc annotations to provide type information in JavaScript files. Note any tags…","html":"<p>The list below outlines which constructs are currently supported\nwhen using JSDoc annotations to provide type information in JavaScript files.</p>\n<p>Note any tags which are not explicitly listed below (such as <code>@async</code>) are not yet supported.</p>\n<ul>\n<li><code>@type</code></li>\n<li><code>@param</code> (or <code>@arg</code> or <code>@argument</code>)</li>\n<li><code>@returns</code> (or <code>@return</code>)</li>\n<li><code>@typedef</code></li>\n<li><code>@callback</code></li>\n<li><code>@template</code></li>\n<li><code>@class</code> (or <code>@constructor</code>)</li>\n<li><code>@this</code></li>\n<li><code>@extends</code> (or <code>@augments</code>)</li>\n<li><code>@enum</code></li>\n</ul>\n<p>The meaning is usually the same, or a superset, of the meaning of the tag given at <a href=\"https://jsdoc.app\">jsdoc.app</a>.\nThe code below describes the differences and gives some example usage of each tag.</p>\n<p><strong>Note:</strong> You can use <a href=\"/play?useJavaScript=truee=4#example/jsdoc-support\">the playground to explore JSDoc support</a>.</p>\n<h2 id=\"type\" style=\"position:relative;\"><a href=\"#type\" aria-label=\"type permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code>@type</code></h2>\n<p>You can use the “@type” tag and reference a type name (either primitive, defined in a TypeScript declaration, or in a JSDoc “@typedef” tag).\nYou can use most JSDoc types and any TypeScript type, from <a href=\"/docs/handbook/basic-types.html\">the most basic like <code>string</code></a> to <a href=\"/docs/handbook/advanced-types.html\">the most advanced, like conditional types</a>.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {string}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var s: string'>s</data-lsp></span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {Window} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var win: Window'>win</data-lsp></span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {PromiseLike&lt;string&gt;} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var promisedString: PromiseLike&amp;lt;string>'>promisedString</data-lsp></span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #008000\">// You can specify an HTML Element with DOM properties</span>\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {HTMLElement} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var myElement: HTMLElement'>myElement</data-lsp></span><span style=\"color: #000000\"> = <data-lsp lsp='var document: Document'>document</data-lsp>.<data-lsp lsp='(method) ParentNode.querySelector&amp;lt;any>(selectors: any): any (+2 overloads)'>querySelector</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='any'>selector</data-lsp></span><span style=\"color: #000000\">);</span>\n<span style=\"color: #1A1A1A\"><data-lsp lsp='module element'>element</data-lsp></span><span style=\"color: #000000\">.</span><span style=\"color: #1A1A1A\"><data-lsp lsp='module element.dataset'>dataset</data-lsp></span><span style=\"color: #000000\">.</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(property) element.dataset.myData: string'>myData</data-lsp></span><span style=\"color: #000000\"> = </span><span style=\"color: #A31515\">\"\"</span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKaQN4Gd4CcCWAdgOYC+UIw4AbgIa6RYDc44oMCK6GA6kQCYB7AO6loVOg2FEWbMHCRpMABVyCAtviyoAMvgDWqADw4CJAHxjKNepGRrN2-gGU8RYrODBIATUEBXSABjWkJGNCD8ADNESFDIAAkAFQBZHUgAUQAbVHVUQnhIaXgAC0gAEQB5FLs1NFx4fFQsOQ5FbmS07Nz8+CsJW3VEbryCyABeSCEg-1H4ADoAR39UXERnVByg+EFcAAptLZ3cAEoWTZ6C+f5aeFptBaHy29oJyAAid6YgA'>Try</a></div></pre>\n<p><code>@type</code> can specify a union type — for example, something can be either a string or a boolean.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {(string | boolean)}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var sb: string | boolean'>sb</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKaQN4AoDO8BOAlgHYDmkAPpAEYD2tANqgIbECUAvlCMOAG7N8kHNQDcQA'>Try</a></div></pre>\n<p>Note that parentheses are optional for union types.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {string | boolean}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var sb: string | boolean'>sb</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKaQN4Gd4CcCWAdgOaQA+kARgPbUA2qAhoQL5QjDgBujukWlANxA'>Try</a></div></pre>\n<p>You can specify array types using a variety of syntaxes:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {number[]} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var ns: number[]'>ns</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {Array.&lt;number&gt;} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var nds: number[]'>nds</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {Array&lt;number&gt;} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var nas: number[]'>nas</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhAIAEBcE8AcCm4DeA7ArgWwEaIE4DaAugL7gjABQAbgIb7hoDOA3FaBDAsigIL58dWADoAPJlwEAfOUq0GTACZsOYKHCSoBQ2BOx58sitXqM0dNkA'>Try</a></div></pre>\n<p>You can also specify object literal types.\nFor example, an object with properties ‘a’ (string) and ‘b’ (number) uses the following syntax:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {{ a: string, b: number }} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var var9: {&amp;#13;    a: string;&amp;#13;    b: number;&amp;#13;}'>var9</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhAIAEBcE8AcCm4DeLwEMBc4DO0AnASwDsBzAGnACMcSBXAW2sQPAF93wRgAoANwxtBBAJwBuIA'>Try</a></div></pre>\n<p>You can specify map-like and array-like objects using string and number index signatures, using either standard JSDoc syntax or TypeScript syntax.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * A map-like object that maps arbitrary `string` properties to `number`s.</span>\n<span style=\"color: #008000\"> *</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {Object.&lt;string, number&gt;}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var stringToNumber: {&amp;#13;    [x: string]: number;&amp;#13;}'>stringToNumber</data-lsp></span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {Object.&lt;number, object&gt;} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var arrayLike: {&amp;#13;    [x: number]: object;&amp;#13;}'>arrayLike</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUhBSC2BDADgWgDYEsDWBTSAewCMArPAYwBdIqALJG5FAZ0iQCdisqPOBPSAAMWvLADsA5kMgoOhFHg5UseNlULDxAVwTElIgHRQI0SAAEq-RZADeAeTKUqhgDyiOEyQBpIOvUoAfAC+JsDgAG6ckB5eACqEAHK6+hwA3ODgoDCW1gQOTtRu-qm+JOTUIdDhURzsHHz8ADK4eGlAA'>Try</a></div></pre>\n<p>The preceding two types are equivalent to the TypeScript types <code>{ [x: string]: number }</code> and <code>{ [x: number]: any }</code>. The compiler understands both syntaxes.</p>\n<p>You can specify function types using either TypeScript or Closure syntax:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {function(string, boolean): number} Closure syntax */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var sbn: (arg0: string, arg1: boolean) => number'>sbn</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {(s: string, b: boolean) =&gt; number} TypeScript syntax */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var sbn2: (s: string, b: boolean) => number'>sbn2</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhAIAEBcE8AcCm4DeAzArgOwMbQJYD2WAFAM7QBO+WA5gDTgBGhhANogIZYCUAXOCwYAtk0SUAvuADCbQmQyVkZWFmicAHuBDAAUADdOlcGSZYA3LtAQYCZCnICK1OoyYCW7Lr3ABeAHyCImKS4AAqdgDKONTw0Caq6lo6BkYmZgBM5kA'>Try</a></div></pre>\n<p>Or you can just use the unspecified <code>Function</code> type:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {Function} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var fn7: Function'>fn7</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {function} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var fn6: Function'>fn6</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhAIAEBcE8AcCm4DeAxArgOwMbQJYD2WAvuCMAFABuAhgE7gBmWA7ANyWgQwLIpNseIqXJU6jFgDZ2QA'>Try</a></div></pre>\n<p>Other types from Closure also work:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {*} - can be &apos;any&apos; type</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var star: any'>star</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {?} - unknown type (same as &apos;any&apos;)</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var question: any'>question</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKaQN4gL6QLSQDGAhgHaQBG6A5GYtZEmlCMOAG7EBOkAzvNwDc4UBGhwm6DAH5cBAK6kA1qQD2Ad3KTIACl7EAtumK9ItUvQCULNpx4BHean4BLVaUFA'>Try</a></div></pre>\n<h3 id=\"casts\" style=\"position:relative;\"><a href=\"#casts\" aria-label=\"casts permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Casts</h3>\n<p>TypeScript borrows cast syntax from Closure.\nThis lets you cast types to other types by adding a <code>@type</code> tag before any parenthesized expression.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {number | string}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var numberOrString: string | number'>numberOrString</data-lsp></span><span style=\"color: #000000\"> = <data-lsp lsp='var Math: Math'>Math</data-lsp>.<data-lsp lsp='(method) Math.random(): number'>random</data-lsp>() &lt; </span><span style=\"color: #09835A\">0.5</span><span style=\"color: #000000\"> ? </span><span style=\"color: #A31515\">\"hello\"</span><span style=\"color: #000000\"> : </span><span style=\"color: #09835A\">100</span><span style=\"color: #000000\">;</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var typeAssertedNumber: number'>typeAssertedNumber</data-lsp></span><span style=\"color: #000000\"> = </span><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {number} */</span><span style=\"color: #000000\"> (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='var numberOrString: string | number'>numberOrString</data-lsp></span><span style=\"color: #000000\">);</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKaQN4DsCuBbAI1QCdIAfSAZ3mIEssBzAXyhGHADcBDU3QkgPLEAyjXoNIAXkgBZLvAAWAOmJcsAEwD2eABQBKSAB5IABiUBWSAH5IAIgWoANo823IALkgBGEyYDcnDyQSGgAgpSUJPCo6gBy+ESk0qAwCCjo2AkkTNDAkDp8iUKidIx6fkA'>Try</a></div></pre>\n<h3 id=\"import-types\" style=\"position:relative;\"><a href=\"#import-types\" aria-label=\"import types permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Import types</h3>\n<p>You can also import declarations from other files using import types.\nThis syntax is TypeScript-specific and differs from the JSDoc standard:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">// @filename: types.d.ts</span>\n<span style=\"color: #0000FF\">export</span><span style=\"color: #000000\"> </span><span style=\"color: #0000FF\">type</span><span style=\"color: #000000\"> <data-lsp lsp='type Pet = {&amp;#13;    name: string;&amp;#13;}'>Pet</data-lsp> = {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(property) name: string'>name</data-lsp></span><span style=\"color: #000000\">: string,</span>\n<span style=\"color: #000000\">};</span>\n\n<span style=\"color: #008000\">// @filename: main.js</span>\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> p { import(\"./types\").Pet }</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function walk(p: import(&amp;quot;./types&amp;quot;).Pet): void'>walk</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) p: Pet'>p</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">  <data-lsp lsp='var console: Console'>console</data-lsp>.<data-lsp lsp='(method) Console.log(...data: any[]): void'>log</data-lsp>(</span><span style=\"color: #A31515\">`Walking ${</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) p: Pet'>p</data-lsp></span><span style=\"color: #A31515\">.<data-lsp lsp='(property) name: string'>name</data-lsp>}...`</span><span style=\"color: #000000\">);</span>\n<span style=\"color: #000000\">}</span></code><a href='https://www.typescriptlang.org/play/#code/PTAEAEDMEsBsFMB2BDAtvAXKALgTwA7wDOAdACYnZEBQ8AHvgPYBO2OB8oACvGwLygA3tVCgU6LEWzNoiAOYAaagF8A3NWogIMBOMyhUyWSQBWNYACoLIixHzJmaUPiGhoqJqwAUAIhLA8QiIfAEoSHjZlG2BqSABXRABjbGhGRFAAd2RYAGsvfBChEVBEtKJGBBJYRjkvAAMAdWyc2TlQABJBfBI9ZRJ+upD1ZSA'>Try</a></div></pre>\n<p>import types can also be used in type alias declarations:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@typedef</span><span style=\"color: #008000\"> { import(\"./types\").Pet } Pet</span>\n<span style=\"color: #008000\"> */</span>\n\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {Pet}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var myPet: Pet'>myPet</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #1A1A1A\"><data-lsp lsp='var myPet: Pet'>myPet</data-lsp></span><span style=\"color: #000000\">.<data-lsp lsp='(property) name: string'>name</data-lsp>;</span></code><a href='https://www.typescriptlang.org/play/#code/PTAEAEDMEsBsFMB2BDAtvAXKALgTwA7wDOAdACYnZEBQ8AHvgPYBO2OB8oACvGwLygA3tVCgU6LEWzNoiAOYAaagF8A3NRAQYCcZlCpkskgCsamgLSWAxgFdsl8xoBUTkU4h5CZeJCGhoqEysABQARCTAnsShAJQkPGzK3LxuwNTOrqDu4FFCCcqp1ABuyMz6uAnqqBW8JLqqQA'>Try</a></div></pre>\n<p>import types can be used to get the type of a value from a module if you don’t know the type, or if it has a large type that is annoying to type:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {typeof import(\"./accounts\").userAccount }</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var x: {&amp;#13;    name: string;&amp;#13;    address: string;&amp;#13;    postalCode: string;&amp;#13;    country: string;&amp;#13;    planet: string;&amp;#13;    system: string;&amp;#13;    galaxy: string;&amp;#13;    universe: string;&amp;#13;}'>x</data-lsp></span><span style=\"color: #000000\"> = <data-lsp lsp='(property) require: any'>require</data-lsp>(</span><span style=\"color: #A31515\">\"./accounts\"</span><span style=\"color: #000000\">).</span><span style=\"color: #1A1A1A\"><data-lsp lsp='const userAccount: {&amp;#13;    name: string;&amp;#13;    address: string;&amp;#13;    postalCode: string;&amp;#13;    country: string;&amp;#13;    planet: string;&amp;#13;    system: string;&amp;#13;    galaxy: string;&amp;#13;    universe: string;&amp;#13;}'>userAccount</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PTAEAEDMEsBsFMB2BDAtvAXKZBjHB7AV0QBcBnAOgBMLyAoeADwAd8AnE0AxMzws+GwCCeIqVABeUAG86oUCnRYARADk08ZQBo52KlTbwyZFUMR6DRstt2teyWAGF8VTKGU35BYiTYBPFU9QZlhkRHgSQJ15Mj9eeFQo3QBzB2RGAPcg4mgAN0EBJIBfAG46EAgYBEU3VGRoRAoAKzJysABaTpxCEk728oAqAbkBiBI-ZngZccn8SFBoVFYOAAplCmBcb1JrAEoKfkERbc4ikeA6XOQ2UEZJUEMAR0JoQzWNrbFyZX3D4VEfCUgA'>Try</a></div></pre>\n<h2 id=\"param-and-returns\" style=\"position:relative;\"><a href=\"#param-and-returns\" aria-label=\"param and returns permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code>@param</code> and <code>@returns</code></h2>\n<p><code>@param</code> uses the same type syntax as <code>@type</code>, but adds a parameter name.\nThe parameter may also be declared optional by surrounding the name with square brackets:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">// Parameters may be declared in a variety of syntactic forms</span>\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string}  </span><span style=\"color: #1A1A1A\">p1</span><span style=\"color: #008000\"> - A string param.</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string=} </span><span style=\"color: #1A1A1A\">p2</span><span style=\"color: #008000\"> - An optional param (Closure syntax)</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string} </span><span style=\"color: #1A1A1A\">[p3]</span><span style=\"color: #008000\"> - Another optional param (JSDoc syntax).</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string} [p4=\"test\"] - An optional param with a default value</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@return</span><span style=\"color: #008000\"> {string} This is the result</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function stringsStringStrings(p1: string, p2?: string | undefined, p3?: string | undefined, p4?: string | undefined): string'>stringsStringStrings</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) p1: string'>p1</data-lsp></span><span style=\"color: #000000\">, </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) p2: string | undefined'>p2</data-lsp></span><span style=\"color: #000000\">, </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) p3: string | undefined'>p3</data-lsp></span><span style=\"color: #000000\">, </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) p4: string | undefined'>p4</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">// TODO</span>\n<span style=\"color: #000000\">}</span></code><a href='https://www.typescriptlang.org/play/#code/PTAEAUEMCdIWwKYBcHQM6jpAnqARgqACYIDGANjAkaAJYB2okoAbjLcrgPYBmoa2ekkikktUqB5docNAChgAKkVzQi0AAEADjHigA3miTQGAcwC+oUFoCMoALSgAgv2NnruuADpV67Z4MjE3pTAF5LLQAmB2dGLi0xLnpIcg9YOFAACgBhci40AFdoQgEhSAAPAEpfTR10wLcQywBtLQBmAF0Yp3ouJAALVFB4xOTUur1MgCkAZQARLglS4SqfNVqAw0aLUFaAFlCAIhQjQ67HHuGE2iSUtL0Ad1oBpmIEHkgC8iRWFIKEGoaYpIIqMLbBHYAFX6tAwsNAA0IxUK318wDkPAK9FEN0YQTMaBm2yJELQmVsABprJEqe1aXtKgZVKAQKBIQB5ObsuTmIA'>Try</a></div></pre>\n<p>Likewise, for the return type of a function:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@return</span><span style=\"color: #008000\"> {PromiseLike&lt;string&gt;}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function ps(): PromiseLike&amp;lt;string>'>ps</data-lsp>() {}</span>\n\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@returns</span><span style=\"color: #008000\"> {{ a: string, b: number }} - May use &apos;</span><span style=\"color: #0000FF\">@returns</span><span style=\"color: #008000\">&apos; as well as &apos;</span><span style=\"color: #0000FF\">@return</span><span style=\"color: #008000\">&apos;</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function ab(): {&amp;#13;    a: string;&amp;#13;    b: number;&amp;#13;}'>ab</data-lsp>() {}</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAnApgFwK7wHaQN4AV4D2AtgJYDOiAMiQNaIA8Zy8JGA5gHwC+UIw4AM1QYAxshIEsABzIAKAJQ4e4UBGhwkaTGRzZIAQwBckJi3YAaSACNjGVESuJ4kLl0gBaSAFl9AT0ioFJAA5Ago6BhkwQY6AO6IADYJMSFhWhjBvPxCouKSBlYKSkA'>Try</a></div></pre>\n<h2 id=\"typedef-callback-and-param\" style=\"position:relative;\"><a href=\"#typedef-callback-and-param\" aria-label=\"typedef callback and param permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code>@typedef</code>, <code>@callback</code>, and <code>@param</code></h2>\n<p><code>@typedef</code> may be used to define complex types.\nSimilar syntax works with <code>@param</code>.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@typedef</span><span style=\"color: #008000\"> {Object} SpecialType - creates a new type named &apos;SpecialType&apos;</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@property</span><span style=\"color: #008000\"> {string} prop1 - a string property of SpecialType</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@property</span><span style=\"color: #008000\"> {number} prop2 - a number property of SpecialType</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@property</span><span style=\"color: #008000\"> {number=} prop3 - an optional number property of SpecialType</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@prop</span><span style=\"color: #008000\"> {number} [prop4] - an optional number property of SpecialType</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@prop</span><span style=\"color: #008000\"> {number} [prop5=42] - an optional number property of SpecialType with default</span>\n<span style=\"color: #008000\"> */</span>\n\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {SpecialType} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var specialTypeObject: SpecialType'>specialTypeObject</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #1A1A1A\"><data-lsp lsp='var specialTypeObject: SpecialType'>specialTypeObject</data-lsp></span><span style=\"color: #000000\">.</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(property) prop3?: number | undefined'>prop3</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKYBNUDNIG8DyARgFaoDG8AvpAMppkCWAhgDYAqKqkAtJGQE6om8VAGdITSADtUAd0hI00pgFsMkAOR1yzdpw1QYsZPwD2afkjyj4-BlIDm1E+YCMPCZBt3HkFxatTHG1GVg40Qzh-VEtEPCkAVxVCGOczZAAmD0lE5Ji-dJjA4PpdcNRI40LY+KSU-gBeNPMAZmypSHN4BlMpVmk6-OiaoNpSsM5K-1q8-moAbX8AFgBdds7kbt7+3PqC8yK40ZCyyego9Jn6hf8AVgaljLXeJg6unr6WAdn9gKOSnQTJSyBjwAAWkEwWCYCRY8EMwHA4FARkUXFwJyBqGoIERADcmPwvOM9GgiKQKABucCiEnlcnkeAAOn8LUpQA'>Try</a></div></pre>\n<p>You can use either <code>object</code> or <code>Object</code> on the first line.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@typedef</span><span style=\"color: #008000\"> {object} SpecialType1 - creates a new type named &apos;SpecialType&apos;</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@property</span><span style=\"color: #008000\"> {string} prop1 - a string property of SpecialType</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@property</span><span style=\"color: #008000\"> {number} prop2 - a number property of SpecialType</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@property</span><span style=\"color: #008000\"> {number=} prop3 - an optional number property of SpecialType</span>\n<span style=\"color: #008000\"> */</span>\n\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {SpecialType1} */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var specialTypeObject1: SpecialType1'>specialTypeObject1</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKYBNUDNIG8D2ARgFaoDG8AvpAMppkCWAhgDYAqKqAjJALSRkATqibxUAZ0hNIAO1QB3SEjSymAWwyQA5HXLN2nLVBixkg-GkFI84+IIYyA5tTMWe-abftPIry9fwcXUZWDjRjOD9UK0Q8GQBXNUJol3NkACY+KVlE5MFfNOiAoPp9MNQI00KYuNzogF5UiwBmLKYZSAt4BnwZVhyk6IKLItjA2lLQzmNgcHBQE2VUPGCyzi5qEFmANyZ88UmDNAB5EnJ4LgBuIA'>Try</a></div></pre>\n<p><code>@param</code> allows a similar syntax for one-off type specifications.\nNote that the nested property names must be prefixed with the name of the parameter:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {Object} </span><span style=\"color: #1A1A1A\">options</span><span style=\"color: #008000\"> - The shape is the same as SpecialType above</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string} </span><span style=\"color: #1A1A1A\">options.prop1</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {number} </span><span style=\"color: #1A1A1A\">options.prop2</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {number=} </span><span style=\"color: #1A1A1A\">options.prop3</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {number} </span><span style=\"color: #1A1A1A\">[options.prop4]</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {number} </span><span style=\"color: #1A1A1A\">[options.prop5=42]</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function special(options: {&amp;#13;    prop1: string;&amp;#13;    prop2: number;&amp;#13;    prop3?: number | undefined;&amp;#13;    prop4: number;&amp;#13;    prop5: number;&amp;#13;}): number'>special</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) options: {&amp;#13;    prop1: string;&amp;#13;    prop2: number;&amp;#13;    prop3?: number | undefined;&amp;#13;    prop4?: number;&amp;#13;    prop5?: number;&amp;#13;}'>options</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">return</span><span style=\"color: #000000\"> (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) options: {&amp;#13;    prop1: string;&amp;#13;    prop2: number;&amp;#13;    prop3?: number | undefined;&amp;#13;    prop4?: number;&amp;#13;    prop5?: number;&amp;#13;}'>options</data-lsp></span><span style=\"color: #000000\">.</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(property) prop4?: number'>prop4</data-lsp></span><span style=\"color: #000000\"> || </span><span style=\"color: #09835A\">1001</span><span style=\"color: #000000\">) + </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) options: {&amp;#13;    prop1: string;&amp;#13;    prop2: number;&amp;#13;    prop3?: number | undefined;&amp;#13;    prop4?: number;&amp;#13;    prop5?: number;&amp;#13;}'>options</data-lsp></span><span style=\"color: #000000\">.</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(property) prop5?: number'>prop5</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #000000\">}</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAHAhgJ0QW0gbwPICMBWApgMYAuAvpAPbykCWVAdgM6QC0kAKgBaGTPdE8PnVale-dH0SsAysOJ1EAG04BPYZES4qAN0JQYCFOizNSyOowDmlGvSbMAdPGQ0AjIbhJUGTIwBXNFxCZDtaBhYXN3gAJi9jXyxA4NCAXnCHKNcaAGYEn1N-IJCwyABte0jnHPgAFgBdApM-FNLKSojHaJoAVjS62KboYHAAMwDGMkj+BSVlAAoqxwBKLChIZEJSAORGSCWu7Ji6yAAfM8h3AAZr9zWAamojmpjegG5wciA'>Try</a></div></pre>\n<p><code>@callback</code> is similar to <code>@typedef</code>, but it specifies a function type instead of an object type:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@callback</span><span style=\"color: #008000\"> Predicate</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string} </span><span style=\"color: #1A1A1A\">data</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {number} </span><span style=\"color: #1A1A1A\">[index]</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@returns</span><span style=\"color: #008000\"> {boolean}</span>\n<span style=\"color: #008000\"> */</span>\n\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {Predicate} */</span>\n<span style=\"color: #0000FF\">const</span><span style=\"color: #000000\"> <data-lsp lsp='const ok: Predicate'>ok</data-lsp> = (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) s: string'>s</data-lsp></span><span style=\"color: #000000\">) </span><span style=\"color: #0000FF\">=&gt;</span><span style=\"color: #000000\"> !(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) s: string'>s</data-lsp></span><span style=\"color: #000000\">.<data-lsp lsp='(property) String.length: number'>length</data-lsp> % </span><span style=\"color: #09835A\">2</span><span style=\"color: #000000\">);</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBBjAhgG2QI0fA1pACgJwFMATASyQBdCoZYAHRfRAW0gG8BnC-UgOwHMAvpGKIKiGnAZNWbXgFdmaQvmEBtPsUIAPALqTYRCvPy8O7NAHtLyQol6CawcOFC0KATzqF2BEuTFCYRBneEszCkhLHABeSAAKDgBKSBiAPkgAQkSAOlsBCgALSABSSAAmJIBuIA'>Try</a></div></pre>\n<p>Of course, any of these types can be declared using TypeScript syntax in a single-line <code>@typedef</code>:</p>\n<pre class=\"shiki\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@typedef</span><span style=\"color: #008000\"> {{ prop1: string, prop2: string, prop3?: number }} SpecialType */</span>\n<span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@typedef</span><span style=\"color: #008000\"> {(data: string, index?: number) =&gt; boolean} Predicate */</span></code></div></pre>\n<h2 id=\"template\" style=\"position:relative;\"><a href=\"#template\" aria-label=\"template permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code>@template</code></h2>\n<p>You can declare generic functions with the <code>@template</code> tag:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@template</span><span style=\"color: #008000\"> T</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {T} </span><span style=\"color: #1A1A1A\">x</span><span style=\"color: #008000\"> - A generic parameter that flows through to the return type</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@return</span><span style=\"color: #008000\"> {T}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function id&amp;lt;T>(x: T): T'>id</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) x: T'>x</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">return</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) x: T'>x</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #000000\">}</span>\n\n<span style=\"color: #0000FF\">const</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='const a: &amp;quot;string&amp;quot;'>a</data-lsp></span><span style=\"color: #000000\"> = <data-lsp lsp='function id&amp;lt;&amp;quot;string&amp;quot;>(x: &amp;quot;string&amp;quot;): &amp;quot;string&amp;quot;'>id</data-lsp>(</span><span style=\"color: #A31515\">\"string\"</span><span style=\"color: #000000\">);</span>\n<span style=\"color: #0000FF\">const</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='const b: 123'>b</data-lsp></span><span style=\"color: #000000\"> = <data-lsp lsp='function id&amp;lt;123>(x: 123): 123'>id</data-lsp>(</span><span style=\"color: #09835A\">123</span><span style=\"color: #000000\">);</span>\n<span style=\"color: #0000FF\">const</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='const c: {}'>c</data-lsp></span><span style=\"color: #000000\"> = <data-lsp lsp='function id&amp;lt;{}>(x: {}): {}'>id</data-lsp>({});</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXApgWwA4BsCGTIBUoyyqYBOmykA3rgL6QAekAtJAIKQDmiAdoiQJYBjSMTLJESEpHgALbJABm6APYB3AM7SZJZQFcOM6cq2JIJCbpLdpAT1SICcc-EvXqNAsHALd3QfH5la34AEwAKegBKKigzCysGAG5wD3BBIPV4SExIAF5IULCAIkyBbg4iyOT07kzIACM8gvCARgAmAGYqtIys4XzCyhoqoA'>Try</a></div></pre>\n<p>Use comma or multiple tags to declare multiple type parameters:</p>\n<pre class=\"shiki\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@template</span><span style=\"color: #008000\"> T,U,V</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@template</span><span style=\"color: #008000\"> W,X</span>\n<span style=\"color: #008000\"> */</span></code></div></pre>\n<p>You can also specify a type constraint before the type parameter name.\nOnly the first type parameter in a list is constrained:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@template</span><span style=\"color: #008000\"> {string} K - K must be a string or string literal</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@template</span><span style=\"color: #008000\"> {{ serious(): string }} Seriousalizable - must have a serious method</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {K} </span><span style=\"color: #1A1A1A\">key</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {Seriousalizable} </span><span style=\"color: #1A1A1A\">object</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function seriousalize&amp;lt;K extends string, Seriousalizable extends {&amp;#13;    serious(): string;&amp;#13;}>(key: K, object: Seriousalizable): void'>seriousalize</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) key: K extends string'>key</data-lsp></span><span style=\"color: #000000\">, </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) object: Seriousalizable extends { serious(): string; }'>object</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">// ????</span>\n<span style=\"color: #000000\">}</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXApgWwA4BsCGTIG8DO8ATgJYB2A5gL6QDSkAtHZMgK6GQBGikmkhpSpAD2RfsXIVI6EkiKZ0UGAhQZsPXLn6JSw9gAoAlAC5xgqVRoBlHST34FJAF6ZO6HkzYcAFpgBuPHz4tvYsiPDewgAmSnComPLIeLQ0ANaIAJ6xsPGJeDa67I4ubog0wpwAVogAxvBKwOAAZqxkdXZk2oUOMk6I+ukZADQiVbXwhnhQkMDAkAD8i-PgVEA'>Try</a></div></pre>\n<p>Declaring generic classes or types is unsupported.</p>\n<h2 id=\"classes\" style=\"position:relative;\"><a href=\"#classes\" aria-label=\"classes permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Classes</h2>\n<p>Classes can be declared as ES6 classes.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #0000FF\">class</span><span style=\"color: #000000\"> <data-lsp lsp='class C'>C</data-lsp> {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\">   * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {number} </span><span style=\"color: #1A1A1A\">data</span>\n<span style=\"color: #008000\">   */</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">constructor</span><span style=\"color: #000000\">(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) data: number'>data</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">    </span><span style=\"color: #008000\">// property types can be inferred</span>\n<span style=\"color: #000000\">    </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(property) C.name: string'>name</data-lsp> = </span><span style=\"color: #A31515\">\"foo\"</span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #000000\">    </span><span style=\"color: #008000\">// or set explicitly</span>\n<span style=\"color: #000000\">    </span><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {string | null} */</span>\n<span style=\"color: #000000\">    </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(property) C.title: string | null'>title</data-lsp> = </span><span style=\"color: #0000FF\">null</span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #000000\">    </span><span style=\"color: #008000\">// or simply annotated, if they&apos;re set elsewhere</span>\n<span style=\"color: #000000\">    </span><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {number} */</span>\n<span style=\"color: #000000\">    </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(property) C.size: number'>size</data-lsp>;</span>\n\n<span style=\"color: #000000\">    </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(property) C.initialize: (s: string) => void'>initialize</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) data: number'>data</data-lsp></span><span style=\"color: #000000\">); </span><span style=\"color: #008000\">// Should error, initializer expects a string</span>\n<span style=\"color: #000000\">  }</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\">   * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string} </span><span style=\"color: #1A1A1A\">s</span>\n<span style=\"color: #008000\">   */</span>\n<span style=\"color: #000000\">  <data-lsp lsp='(property) C.initialize: typeof (Anonymous function)'>initialize</data-lsp> = </span><span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) s: string'>s</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">    </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(property) (Anonymous function).size: number'>size</data-lsp> = </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) s: string'>s</data-lsp></span><span style=\"color: #000000\">.<data-lsp lsp='(property) String.length: number'>length</data-lsp>;</span>\n<span style=\"color: #000000\">  };</span>\n<span style=\"color: #000000\">}</span>\n\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var c: C'>c</data-lsp></span><span style=\"color: #000000\"> = </span><span style=\"color: #0000FF\">new</span><span style=\"color: #000000\"> <data-lsp lsp='constructor C(data: number): C'>C</data-lsp>(</span><span style=\"color: #09835A\">0</span><span style=\"color: #000000\">);</span>\n\n<span style=\"color: #008000\">// C should only be called with new, but</span>\n<span style=\"color: #008000\">// because it is JavaScript, this is allowed and</span>\n<span style=\"color: #008000\">// considered an &apos;any&apos;.</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var result: any'>result</data-lsp></span><span style=\"color: #000000\"> = <data-lsp lsp='class C'>C</data-lsp>(</span><span style=\"color: #09835A\">1</span><span style=\"color: #000000\">);</span></code><a href='https://www.typescriptlang.org/play/#code/MYGwhgzhAEDC0G8BQ1oHoBUGWo9AAgA5gBOYAtogHYCu5ARgKYkC+0AJmAC5g7QZocwAPZUIXEjWBdhJABSceASkR90aaIRLDCzLgE9oB3TGBgq0JtACWVAGbMSjdmq4ALaxAB0VCo2gAvNAARHbCwsEA3EhqaBqy0BCMXNCMAB6EINbA1lwg+rFYBMb+COIktgDm0AA+0LQgIGwCrh7eXLkg-kENINGx8SSJ1uSZhuZUwjxczgA0NnZGboz6AOROicmpIEkA7stOhXj4JdR0TKz8gqio7p5eENYAXoz9N0v3trnWYFkvCtwwEpIupoABlNzCGggdipEjaEjzL4dX7PZipDKMaQwMCJCRVHAsHCYbA3Y7EMiUMr4qiVNgQPgtVDIn5-brQOw0KjSayiaByCAqZDvO7eR4vQKJLxdWnuaKoFjRIlIABupGgwElVEYuzgcgADMCYnE4IlIdDYaJ8pZ-GZGs5oLtcm56jr5vQaFwkCamGYaEkbClPNAAFJgNVg4AVQhceaimw4xrCXYO8wuE0iMTWdjMVMWVbmNZeVXqpwQaEpIKwOQARmBQA'>Try</a></div></pre>\n<p>They can also be declared as constructor functions, as described in the next section:</p>\n<h2 id=\"constructor\" style=\"position:relative;\"><a href=\"#constructor\" aria-label=\"constructor permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code>@constructor</code></h2>\n<p>The compiler infers constructor functions based on this-property assignments, but you can make checking stricter and suggestions better if you add a <code>@constructor</code> tag:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@constructor</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {number} </span><span style=\"color: #1A1A1A\">data</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function C(data: number): void'>C</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) data: number'>data</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">// property types can be inferred</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(property) C.name: string'>name</data-lsp> = </span><span style=\"color: #A31515\">\"foo\"</span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">// or set explicitly</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {string | null} */</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(property) C.title: string | null'>title</data-lsp> = </span><span style=\"color: #0000FF\">null</span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">// or simply annotated, if they&apos;re set elsewhere</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {number} */</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(property) C.size: number'>size</data-lsp>;</span>\n\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(method) C.initialize(s: string): void'>initialize</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-err><data-lsp lsp='(parameter) data: number'>data</data-lsp></data-err></span><span style=\"color: #000000\">);</span>\n<span class=\"error\"><span>Argument of type 'number' is not assignable to parameter of type 'string'.</span><span class=\"code\">2345</span></span><span class=\"error-behind\">Argument of type 'number' is not assignable to parameter of type 'string'.</span><span style=\"color: #000000\">}</span>\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string} </span><span style=\"color: #1A1A1A\">s</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #000000\"><data-lsp lsp='class C&amp;#13;function C(data: number): void'>C</data-lsp>.<data-lsp lsp='(property) Function.prototype: any'>prototype</data-lsp>.<data-lsp lsp='(method) C.initialize(s: string): void'>initialize</data-lsp> = </span><span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) s: string'>s</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.<data-lsp lsp='(property) C.size: number'>size</data-lsp> = </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) s: string'>s</data-lsp></span><span style=\"color: #000000\">.<data-lsp lsp='(property) String.length: number'>length</data-lsp>;</span>\n<span style=\"color: #000000\">};</span>\n\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var c: C'>c</data-lsp></span><span style=\"color: #000000\"> = </span><span style=\"color: #0000FF\">new</span><span style=\"color: #000000\"> <data-lsp lsp='constructor C(data: number): C'>C</data-lsp>(</span><span style=\"color: #09835A\">0</span><span style=\"color: #000000\">);</span>\n<span style=\"color: #1A1A1A\"><data-lsp lsp='var c: C'>c</data-lsp></span><span style=\"color: #000000\">.<data-lsp lsp='(property) C.size: number'>size</data-lsp>;</span>\n\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var result: any'>result</data-lsp></span><span style=\"color: #000000\"> = <data-lsp lsp='function C(data: number): void'>C</data-lsp>(</span><span style=\"color: #09835A\">1</span><span style=\"color: #000000\">);</span>\n<span class=\"error\"><span>Value of type 'typeof C' is not callable. Did you mean to include 'new'?</span><span class=\"code\">2348</span></span><span class=\"error-behind\">Value of type 'typeof C' is not callable. Did you mean to include 'new'?</span></code><a href='https://www.typescriptlang.org/play/#code/PTAEAEGMAsFNINYCkDOAoEFYCdsHtsUAuUAJgGYAWAVjKoA4MAqJtUJiSPAOxQBdsAV0h8CbDuAAOAQ2zSAtqADe3QfIBGOAL6gAJtL7TxwNADNB3EQEseoAMIAKfYYCUytqEyT8knHwCeoAG+KKCQ0tygmqBW3KY42LC6HnzQVigAdNwKsKAAvKAARKZ4eIUA3GgemASgKLB8oLAAHpIANlaQVnxt-tUsEMG5SvzYsQDmoAA+oKptbTpMJqBBaZl83W25BXNtldVgtShW8u2BEdx4hnxJADQxpquw-gDkiXUNTW31AO5wif0JENlKoNNp2MtVukMscAF6wfYrVLQ2LdKzSDrwpwGaQuSpaZisdgQGRyRQjAQTHToCFoOwZbxXK7+XwZVEbDFWeH5UDmSwbWwOFBuJQpNYwrnbOoZLbccapfH7ABusjCPO4sB+9gcAAY8WhIBL4crVYkUII2o0Co4AIx4oA'>Try</a></div></pre>\n<blockquote>\n<p>Note: Error messages only show up in JS codebases with <a href=\"/docs/handbook/tsconfig-json.html\">a JSConfig</a> and <a href=\"/tsconfig#checkJs\"><code>checkJs</code></a> enabled.</p>\n</blockquote>\n<p>With <code>@constructor</code>, <code>this</code> is checked inside the constructor function <code>C</code>, so you will get suggestions for the <code>initialize</code> method and an error if you pass it a number. Your editor may also show warnings if you call <code>C</code> instead of constructing it.</p>\n<p>Unfortunately, this means that constructor functions that are also callable cannot use <code>@constructor</code>.</p>\n<h2 id=\"this\" style=\"position:relative;\"><a href=\"#this\" aria-label=\"this permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code>@this</code></h2>\n<p>The compiler can usually figure out the type of <code>this</code> when it has some context to work with. When it doesn’t, you can explicitly specify the type of <code>this</code> with <code>@this</code>:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@this</span><span style=\"color: #008000\"> {HTMLElement}</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {*} </span><span style=\"color: #1A1A1A\">e</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function callbackForLater(e: any): void'>callbackForLater</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) e: any'>e</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">this</span><span style=\"color: #000000\">.</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(property) callbackForLater.clientHeight: number'>clientHeight</data-lsp></span><span style=\"color: #000000\"> = <data-lsp lsp='function parseInt(s: string, radix?: number | undefined): number'>parseInt</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) e: any'>e</data-lsp></span><span style=\"color: #000000\">); </span><span style=\"color: #008000\">// should be fine!</span>\n<span style=\"color: #000000\">}</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAFgSwM6QN4AkAqBZAGQFEAbAUwFsyA7eAXyhlgAcBDAJ1YsxDsjMbBwAMwCu1AMbxkAe2qQJrEiQBGrCQGsAYjPYFW8MuwAUZAJSYokJGgB0EkshrwsZZAHNE8SAF5IbdlQyAElaUzMAbkhgYEhURBlREgATSBUySGFkajIAQnA6IA'>Try</a></div></pre>\n<h2 id=\"extends\" style=\"position:relative;\"><a href=\"#extends\" aria-label=\"extends permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code>@extends</code></h2>\n<p>When Javascript classes extend a generic base class, there is nowhere to specify what the type parameter should be. The <code>@extends</code> tag provides a place for that type parameter:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@template</span><span style=\"color: #008000\"> T</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@extends</span><span style=\"color: #008000\"> {Set&lt;T&gt;}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">class</span><span style=\"color: #000000\"> <data-lsp lsp='class SortableSet&amp;lt;T>'>SortableSet</data-lsp> </span><span style=\"color: #0000FF\">extends</span><span style=\"color: #000000\"> <data-lsp lsp='var Set: SetConstructor'>Set</data-lsp> {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">// ...</span>\n<span style=\"color: #000000\">}</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXApgWwA4BsCGTIBUoyyIAeSAdgCYDOkA3gMqLwA8uAfAL4HDgDGWVGvQD2AJ3iYARukSN4kEuWqQ5dKJGDBIAOl3gOQA'>Try</a></div></pre>\n<p>Note that <code>@extends</code> only works with classes. Currently, there is no way for a constructor function extend a class.</p>\n<h2 id=\"enum\" style=\"position:relative;\"><a href=\"#enum\" aria-label=\"enum permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a><code>@enum</code></h2>\n<p>The <code>@enum</code> tag allows you to create an object literal whose members are all of a specified type. Unlike most object literals in Javascript, it does not allow other members.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@enum</span><span style=\"color: #008000\"> {number} */</span>\n<span style=\"color: #0000FF\">const</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='type JSDocState = number&amp;#13;const JSDocState: {&amp;#13;    BeginningOfLine: number;&amp;#13;    SawAsterisk: number;&amp;#13;    SavingComments: number;&amp;#13;}'>JSDocState</data-lsp></span><span style=\"color: #000000\"> = {</span>\n<span style=\"color: #000000\">  <data-lsp lsp='(property) BeginningOfLine: number'>BeginningOfLine</data-lsp>: </span><span style=\"color: #09835A\">0</span><span style=\"color: #000000\">,</span>\n<span style=\"color: #000000\">  <data-lsp lsp='(property) SawAsterisk: number'>SawAsterisk</data-lsp>: </span><span style=\"color: #09835A\">1</span><span style=\"color: #000000\">,</span>\n<span style=\"color: #000000\">  <data-lsp lsp='(property) SavingComments: number'>SavingComments</data-lsp>: </span><span style=\"color: #09835A\">2</span><span style=\"color: #000000\">,</span>\n<span style=\"color: #000000\">};</span>\n\n<span style=\"color: #1A1A1A\"><data-lsp lsp='const JSDocState: {&amp;#13;    BeginningOfLine: number;&amp;#13;    SawAsterisk: number;&amp;#13;    SavingComments: number;&amp;#13;}'>JSDocState</data-lsp></span><span style=\"color: #000000\">.</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(property) SawAsterisk: number'>SawAsterisk</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhAIAEFMDsFcC24DeDECNoCcC+4RgAoAYwHtYBnAF3ACkBlAETJIeoENrpwBeVIuHAAhaAHMAlrFhSxAeQBmAGSnQAXOAAMAGkHgGHAO4BBGjgmUA1hoCMuoQYBusgMJlEiONUoaATLtwAbiIiRhY2Tm4AOgMTM2wLS0CgA'>Try</a></div></pre>\n<p>Note that <code>@enum</code> is quite different from, and much simpler than, TypeScript’s <code>enum</code>. However, unlike TypeScript’s enums, <code>@enum</code> can have any type:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/** </span><span style=\"color: #0000FF\">@enum</span><span style=\"color: #008000\"> {function(number): number} */</span>\n<span style=\"color: #0000FF\">const</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='type MathFuncs = (arg0: number) => number&amp;#13;const MathFuncs: {&amp;#13;    add1: (n: any) => any;&amp;#13;    id: (n: any) => number;&amp;#13;    sub1: (n: any) => number;&amp;#13;}'>MathFuncs</data-lsp></span><span style=\"color: #000000\"> = {</span>\n<span style=\"color: #000000\">  <data-lsp lsp='(property) add1: (n: any) => any'>add1</data-lsp>: (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) n: any'>n</data-lsp></span><span style=\"color: #000000\">) </span><span style=\"color: #0000FF\">=&gt;</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) n: any'>n</data-lsp></span><span style=\"color: #000000\"> + </span><span style=\"color: #09835A\">1</span><span style=\"color: #000000\">,</span>\n<span style=\"color: #000000\">  <data-lsp lsp='(property) id: (n: any) => number'>id</data-lsp>: (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) n: any'>n</data-lsp></span><span style=\"color: #000000\">) </span><span style=\"color: #0000FF\">=&gt;</span><span style=\"color: #000000\"> -</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) n: any'>n</data-lsp></span><span style=\"color: #000000\">,</span>\n<span style=\"color: #000000\">  <data-lsp lsp='(property) sub1: (n: any) => number'>sub1</data-lsp>: (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) n: any'>n</data-lsp></span><span style=\"color: #000000\">) </span><span style=\"color: #0000FF\">=&gt;</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) n: any'>n</data-lsp></span><span style=\"color: #000000\"> - </span><span style=\"color: #09835A\">1</span><span style=\"color: #000000\">,</span>\n<span style=\"color: #000000\">};</span>\n\n<span style=\"color: #1A1A1A\"><data-lsp lsp='const MathFuncs: {&amp;#13;    add1: (n: any) => any;&amp;#13;    id: (n: any) => number;&amp;#13;    sub1: (n: any) => number;&amp;#13;}'>MathFuncs</data-lsp></span><span style=\"color: #000000\">.</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(property) add1: (n: any) => any'>add1</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhAIAEFMDsFcC24DeAzesDGAXAlgPawAUCiARtAE4CUAXOGZVQL7gjABQWRAzjuACyAQxwALAGKYsvcAF5UncOGEATVQEYGpGvIB8jcAGpwGgDRLweVdti65BgLSwLy3vHJbwO-YcemLFgBuTk4RcSlsXgA6NU0goA'>Try</a></div></pre>\n<h2 id=\"more-examples\" style=\"position:relative;\"><a href=\"#more-examples\" aria-label=\"more examples permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>More examples</h2>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var someObj: {&amp;#13;    x: (param1: string) => void;&amp;#13;}'>someObj</data-lsp></span><span style=\"color: #000000\"> = {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\">   * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string} </span><span style=\"color: #1A1A1A\">param1</span><span style=\"color: #008000\"> - Docs on property assignments work</span>\n<span style=\"color: #008000\">   */</span>\n<span style=\"color: #000000\">  <data-lsp lsp='(property) x: (param1: string) => void'>x</data-lsp>: </span><span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) param1: string'>param1</data-lsp></span><span style=\"color: #000000\">) {},</span>\n<span style=\"color: #000000\">};</span>\n\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * As do docs on variable assignments</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@return</span><span style=\"color: #008000\"> {Window}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">let</span><span style=\"color: #000000\"> <data-lsp lsp='let someFunc: () => Window'>someFunc</data-lsp> = </span><span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> () {};</span>\n\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * And class methods</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {string} </span><span style=\"color: #1A1A1A\">greeting</span><span style=\"color: #008000\"> The greeting to use</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #000000\"><data-lsp lsp='class Foo'>Foo</data-lsp>.<data-lsp lsp='(property) Foo.prototype: Foo'>prototype</data-lsp>.<data-lsp lsp='(method) Foo.sayHi(greeting: string): void'>sayHi</data-lsp> = (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) greeting: string'>greeting</data-lsp></span><span style=\"color: #000000\">) </span><span style=\"color: #0000FF\">=&gt;</span><span style=\"color: #000000\"> <data-lsp lsp='var console: Console'>console</data-lsp>.<data-lsp lsp='(method) Console.log(...data: any[]): void'>log</data-lsp>(</span><span style=\"color: #A31515\">\"Hi!\"</span><span style=\"color: #000000\">);</span>\n\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * And arrow functions expressions</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {number} </span><span style=\"color: #1A1A1A\">x</span><span style=\"color: #008000\"> - A multiplier</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">let</span><span style=\"color: #000000\"> <data-lsp lsp='let myArrow: (x: number) => number'>myArrow</data-lsp> = (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) x: number'>x</data-lsp></span><span style=\"color: #000000\">) </span><span style=\"color: #0000FF\">=&gt;</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) x: number'>x</data-lsp></span><span style=\"color: #000000\"> * </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) x: number'>x</data-lsp></span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * Which means it works for stateless function components in JSX too</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {{a: string, b: number}} test - Some param</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> <data-lsp lsp='var sfc: (test: {&amp;#13;    a: string;&amp;#13;    b: number;&amp;#13;}) => any'>sfc</data-lsp> = (</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) test: {&amp;#13;    a: string;&amp;#13;    b: number;&amp;#13;}'>test</data-lsp></span><span style=\"color: #000000\">) </span><span style=\"color: #0000FF\">=&gt;</span><span style=\"color: #000000\"> </span><span style=\"color: #800000\">&lt;<data-lsp lsp='any'>div</data-lsp>></span><span style=\"color: #000000\">{</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) test: {&amp;#13;    a: string;&amp;#13;    b: number;&amp;#13;}'>test</data-lsp></span><span style=\"color: #000000\">.</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(property) a: string'>a</data-lsp></span><span style=\"color: #000000\">.<data-lsp lsp='(method) String.charAt(pos: number): string'>charAt</data-lsp>(</span><span style=\"color: #09835A\">0</span><span style=\"color: #000000\">)}</span><span style=\"color: #800000\">&lt;/<data-lsp lsp='any'>div</data-lsp>></span><span style=\"color: #000000\">;</span>\n\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * A parameter can be a class constructor, using Closure syntax.</span>\n<span style=\"color: #008000\"> *</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {{new(...args: any[]): object}} C - The class to register</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function registerClass(C: new (...args: any[]) => object): void'>registerClass</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) C: new (...args: any[]) => object'>C</data-lsp></span><span style=\"color: #000000\">) {}</span>\n\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {...string} </span><span style=\"color: #1A1A1A\">p1</span><span style=\"color: #008000\"> - A &apos;rest&apos; arg (array) of strings. (treated as &apos;any&apos;)</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function fn10(p1: string[]): void'>fn10</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) p1: string | undefined'>p1</data-lsp></span><span style=\"color: #000000\">) {}</span>\n\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@param</span><span style=\"color: #008000\"> {...string} </span><span style=\"color: #1A1A1A\">p1</span><span style=\"color: #008000\"> - A &apos;rest&apos; arg (array) of strings. (treated as &apos;any&apos;)</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function fn9(p1: string[]): any'>fn9</data-lsp>(</span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) p1: string | undefined'>p1</data-lsp></span><span style=\"color: #000000\">) {</span>\n<span style=\"color: #000000\">  </span><span style=\"color: #0000FF\">return</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='(parameter) p1: string | undefined'>p1</data-lsp></span><span style=\"color: #000000\">.<data-lsp lsp='any'>join</data-lsp>();</span>\n<span style=\"color: #000000\">}</span></code><a href='https://www.typescriptlang.org/play/#code/MYGwhgzhAEBiD29oG8C+AoA9J6BafwArgC767oBuYATtBPALYCmA8gEYBW0AvCutNEwAqIfwFDoAAQAONMAxQRi1AJYA7AOapos6vICMeaABF4wGPDU7q8aU2rEAntEgQVGtczXEYAd3jUANZi0EKYYgAeAFzQAGaEasDEKpbQABS6BgCUKKgANOioANzoWCL8EgCCMAAmSHXm0KlUqmBsIEwuUO6eTN4QFVLUTMSE1FbIAOrqdb4YoeEdxHSMTLAJwDxxG8mpaTloJWWiodCVajXQoK7QzMQAFvA1A6cycgrISqqa2hrDI+oNNAACr3Tp-JgAzTQYhIQgQJgVcIIeAAOmkNlhTjsqIgYEcAAkVFs0hCoRoctwAHxXSz0DqokDwDRpABERIAhKyskdhCcqhcXNQbL5toldmoYEwIhimN06YM3noPmpCAw2PZtBEjJVboQQMlpCAVPYkeglrdHJVhfBRbw0hFKTTtRIIrzyqdJvcVMB7rcmGBJdAVMt-EEYLEAnRiGBiEwOlAxUkUlZgIxpJY+j5g1YAFIAZQAGjDEIrMh9kGAYl9AXloGwYqr1ZrtHGlEZ86sdO8zS06LFNva28QndAADw1FQUKnIYeosCo300SrENIABiyqDHmEn0-d-LO3eVI3sV0D9c6YCu4ETaclykISQCdfhgOgAGEmRAxp0II5vGAESohUZbvCgyBqEwvhpKisE0BoEAxIGjgANoALpZDE8CcEwSSoNo75GKCnTXImsLQMMGgqEopoLOg8TiimFFMFRNHUJ+rhpO+BwYMcoHKigsG4sogLaNIhi4IeADkwxKFJQpAmkNB6I4OTwLE0bfAhqLpMoAZxpckDQFJyFSVkZoMcmqSxGo+hrhk+g8aUfL8fIgmwTWPw6BJ0mycQ8nwekyn4mpGmedpunDLGTCGTAJlqI4ZkWTsTE2QAnA5BxiMMozjN5qIcPA6j7CUqBAA'>Try</a></div></pre>\n<h2 id=\"patterns-that-are-known-not-to-be-supported\" style=\"position:relative;\"><a href=\"#patterns-that-are-known-not-to-be-supported\" aria-label=\"patterns that are known not to be supported permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Patterns that are known NOT to be supported</h2>\n<p>Referring to objects in the value space as types doesn’t work unless the object also creates a type, like a constructor function.</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #0000FF\">function</span><span style=\"color: #000000\"> <data-lsp lsp='function aNormalFunction(): void'>aNormalFunction</data-lsp>() {}</span>\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {aNormalFunction}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var wrong: () => void'>wrong</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * Use &apos;typeof&apos; instead:</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {typeof aNormalFunction}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var right: () => void'>right</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/GYVwdgxgLglg9mABAQwHJwE4FtkBsBi408YAFAJSIDeAvgFAD0AVE3Yk4gAJQCeADgFNqaTDgJFYCeuwZ0AbsgyIA7hgQBzANyMWbDgFUAzkIDkvQXGAnEMMIagDkAEwBceruaFVPllOmx4hJCSYNJMsgpKGDDqABZQmkA'>Try</a></div></pre>\n<p>Postfix equals on a property type in an object literal type doesn’t specify an optional property:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {{ a: string, b: number= }}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var wrong: {&amp;#13;    a: string;&amp;#13;    b: number;&amp;#13;}'>wrong</data-lsp></span><span style=\"color: #000000\">;</span>\n<span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * Use postfix question on the property name instead:</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {{ a: string, b?: number }}</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var right: {&amp;#13;    a: string;&amp;#13;    b?: number | undefined;&amp;#13;}'>right</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKaQN4cgQwFyQDO8ATgJYB2A5gDSQBGBFArgLb2okC8kAvr1BDBwANxwlIAdxIB7agG5woCNEgBVQumQziAMzIAPSAEdmqYmTmQr8ABZbZaEkkgUcrdJWKocAEzyCcEhomNj4RKSUtAwA-ExsHBL8gsJiEuRUtvDyQA'>Try</a></div></pre>\n<p>Nullable types only have meaning if <code>strictNullChecks</code> is on:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {?number}</span>\n<span style=\"color: #008000\"> * With strictNullChecks: true  -- number | null</span>\n<span style=\"color: #008000\"> * With strictNullChecks: false -- number</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var nullable: number | null'>nullable</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKaQN4H4B2BXAWwCNUAnAXyhgHUBLeAC0gGd5TaBjeAOTwBs+AYQaoOAa2YAuSGzzpIAWgWR8xMpAA+K-nyqQ6jFm048dw0ROkAzAIZ9m6JdrWkqwcADcbpbQJtE+VABuIA'>Try</a></div></pre>\n<p>You can also use a union type:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {number | null}</span>\n<span style=\"color: #008000\"> * With strictNullChecks: true  -- number | null</span>\n<span style=\"color: #008000\"> * With strictNullChecks: false -- number</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var unionNullable: number | null'>unionNullable</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKaQN4DsCuBbAI1QCdIAfSXAGyoF8oYB1AS3gAtIBneY5gY3gA5HDQDCbVHwDWnAFyQeOdJAC0KyviKkK1Kg0gt2XHvyEiq4yTPkAzAIZVO6NRsIkGwcADc7pHFmYAeyxhGjsCKlQAbiA'>Try</a></div></pre>\n<p>Non-nullable types have no meaning and are treated just as their original type:</p>\n<pre class=\"shiki twoslash\"><div class=\"language-id\">js</div><div class='code-container'><code><span style=\"color: #008000\">/**</span>\n<span style=\"color: #008000\"> * </span><span style=\"color: #0000FF\">@type</span><span style=\"color: #008000\"> {!number}</span>\n<span style=\"color: #008000\"> * Just has type number</span>\n<span style=\"color: #008000\"> */</span>\n<span style=\"color: #0000FF\">var</span><span style=\"color: #000000\"> </span><span style=\"color: #1A1A1A\"><data-lsp lsp='var normal: number'>normal</data-lsp></span><span style=\"color: #000000\">;</span></code><a href='https://www.typescriptlang.org/play/#code/PQKhCgAIUgBAXAngBwKaQN4EIB2BXAWwCNUAnAXyhgCk8BneSACwEM7Ik1J9iyrhwANxaluAe1IEWAGwDcQA'>Try</a></div></pre>\n<p>Unlike JSDoc’s type system, TypeScript only allows you to mark types as containing null or not.\nThere is no explicit non-nullability — if strictNullChecks is on, then <code>number</code> is not nullable.\nIf it is off, then <code>number</code> is nullable.</p>\n<h3 id=\"unsupported-tags\" style=\"position:relative;\"><a href=\"#unsupported-tags\" aria-label=\"unsupported tags permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Unsupported tags</h3>\n<p>TypeScript ignores any unsupported JSDoc tags.</p>\n<p>The following tags have open issues to support them:</p>\n<ul>\n<li><code>@const</code> (<a href=\"https://github.com/Microsoft/TypeScript/issues/19672\">issue #19672</a>)</li>\n<li><code>@inheritdoc</code> (<a href=\"https://github.com/Microsoft/TypeScript/issues/23215\">issue #23215</a>)</li>\n<li><code>@memberof</code> (<a href=\"https://github.com/Microsoft/TypeScript/issues/7237\">issue #7237</a>)</li>\n<li><code>@readonly</code> (<a href=\"https://github.com/Microsoft/TypeScript/issues/17233\">issue #17233</a>)</li>\n<li><code>@yields</code> (<a href=\"https://github.com/Microsoft/TypeScript/issues/23857\">issue #23857</a>)</li>\n<li><code>{@link …}</code> (<a href=\"https://github.com/Microsoft/TypeScript/issues/16498\">issue #16498</a>)</li>\n</ul>","headings":[{"value":"@type","depth":2},{"value":"Casts","depth":3},{"value":"Import types","depth":3},{"value":"@param and @returns","depth":2},{"value":"@typedef, @callback, and @param","depth":2},{"value":"@template","depth":2},{"value":"Classes","depth":2},{"value":"@constructor","depth":2},{"value":"@this","depth":2},{"value":"@extends","depth":2},{"value":"@enum","depth":2},{"value":"More examples","depth":2},{"value":"Patterns that are known NOT to be supported","depth":2},{"value":"Unsupported tags","depth":3}],"frontmatter":{"permalink":"/docs/handbook/jsdoc-supported-types.html","title":"JSDoc Reference","disable_toc":null,"oneline":"What JSDoc does TypeScript-powered JavaScript support?"}},"prev":{"childMarkdownRemark":{"frontmatter":{"title":"Type Checking JavaScript Files","oneline":"How to add type checking to JavaScript files using TypeScript","permalink":"/docs/handbook/type-checking-javascript-files.html"}}},"next":{"childMarkdownRemark":{"frontmatter":{"title":"Creating .d.ts Files from .js files","oneline":"How to add d.ts generation to JavaScript projects","permalink":"/docs/handbook/declaration-files/dts-from-js.html"}}}},"pageContext":{"id":"jsdoc-reference","slug":"/docs/handbook/jsdoc-supported-types.html","repoPath":"/packages/documentation/copy/en/javascript/JSDoc Reference.md","previousID":"cedd21fa-eeaa-55f3-9c1b-b658afa2602a","nextID":"663edd65-8c2e-5cf1-a213-c61422f22fd3","lang":"en","modifiedTime":"2020-08-07T17:00:36.335Z"}}}