@memberof Parent is a JSDoc documentation tag that files a function or value under another object in the documentation that the JSDoc tool builds. TypeScript does not support it; the handbook lists it, with an open issue, among the tags it does not read. A function tagged @memberof Cart is still a standalone function, and Cart.total does not exist.
TypeScript learns about members from the code. Assigning Cart.total = function … after the class, or writing static total() inside it, gives the class the member, with types from the function's JSDoc.
At a glance
| Use | JSDoc in a .js file | TypeScript in a .ts file |
|---|---|---|
| A function stored on a class | /** @param {Cart} cart */
Cart.total = function (cart) { … }; | class Cart {
static total(cart: Cart) { … }
} |
Examples
export class Cart {
/** @type {number[]} */
prices = [];
}
/**
* @memberof Cart
* @param {Cart} cart
*/
export function total(cart) {
return cart.prices.reduce((sum, price) => sum + price, 0);
}
Cart.total(new Cart());error TS2339: Property 'total' does not exist on type 'typeof Cart'.jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} export class Cart {
/** @type {number[]} */
prices = [];
}
/** @param {Cart} cart */
Cart.total = function (cart) {
return cart.prices.reduce((sum, price) => sum + price, 0);
};
Cart.total(new Cart());export class Cart {
prices: number[] = [];
static total(cart: Cart) {
return cart.prices.reduce((sum, price) => sum + price, 0);
}
}
Cart.total(new Cart());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 a function @memberof Cart and calls Cart.total(…). If the tag were read, the call would type-check. tsc reports TS2339 ("Property 'total' does not exist on type 'typeof Cart'").
Members TypeScript reads
In a .js file, an assignment to a property of a class, a function or an object literal declared in the same file adds that property to its type. That is how TypeScript types older patterns such as Cart.total = … or utils.format = …, and it is why those assignments need no tag.
Gotchas
- Assignments add members only to declarations in the same file. To add to something imported, declare it in a
.d.tsfile instead. - Keep
@memberofif your documentation tool uses it; TypeScript leaves it in the hover as text.
Questions
Is @memberof supported by TypeScript?
No. The handbook lists it as unsupported (tracked as issue 7237 in the TypeScript repository). TypeScript 5.9 ignores it.
Sources
- JSDoc Reference: unsupported tags · TypeScript handbook
- Support @memberof (issue 7237) · TypeScript on GitHub
- @memberof · JSDoc
- Type Checking JavaScript Files: property assignments · TypeScript handbook
Last reviewed 20 October 2026.