@static is a JSDoc documentation tag for a member that belongs to a class or function itself rather than to its instances. TypeScript 5.9 ignores it: a method tagged @static is still an instance method, and calling it on the class is an error (TS2339).
JavaScript has the static keyword for this, and TypeScript reads it in .js files. For older code, assigning a function to a property of the class after its declaration also adds a static member.
At a glance
| Use | JSDoc in a .js file | TypeScript in a .ts file |
|---|---|---|
| A static method | class Temperature {
static fromCelsius(celsius) { … }
} | class Temperature {
static fromCelsius(celsius: number) { … }
} |
| A static property added later | Temperature.toCelsius = (f) => …; | class Temperature {
static toCelsius = (f: number) => …;
} |
Examples
export class Temperature {
/**
* @static
* @param {number} celsius
*/
fromCelsius(celsius) {
return celsius * 1.8 + 32;
}
}
Temperature.fromCelsius(20);error TS2339: Property 'fromCelsius' does not exist on type 'typeof Temperature'.jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} export class Temperature {
/** @param {number} celsius */
static fromCelsius(celsius) {
return celsius * 1.8 + 32;
}
}
/** @param {number} fahrenheit */
Temperature.toCelsius = (fahrenheit) => (fahrenheit - 32) / 1.8;
Temperature.fromCelsius(20);
Temperature.toCelsius(68);export class Temperature {
static fromCelsius(celsius: number) {
return celsius * 1.8 + 32;
}
static toCelsius = (fahrenheit: number) => (fahrenheit - 32) / 1.8;
}
Temperature.fromCelsius(20);
Temperature.toCelsius(68);jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} How we tested it
The first example tags an ordinary method @static and calls Temperature.fromCelsius(20). If the tag were read, the call would pass; tsc reports "Property 'fromCelsius' does not exist on type 'typeof Temperature'".
Static members in JavaScript
static works on methods, fields, getters and blocks in any class. An assignment such as Temperature.toCelsius = … in the same file is read as a static member too, typed from the assigned function and its JSDoc. Both appear in the second example.
Gotchas
- For constructor functions, the same assignment pattern applies:
Counter.create = function () { … }addscreateto the function's type. - Keep
@staticif your documentation tool needs it to file a member; TypeScript shows it in the hover as text.
Questions
How do I document a static method with JSDoc for TypeScript?
Write the static keyword on the method and document it with @param and @returns as usual. No tag is needed.
Sources
- @static · JSDoc
- Classes: static members · TypeScript handbook
- JSDoc Reference · TypeScript handbook
Last reviewed 20 October 2026.