JSDoc tag

@memberof

  • Not checked by TypeScript
  • Tested with TypeScript 5.9

@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

cart.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: cart.js(15,6): error TS2339: Property 'total' does not exist on type 'typeof Cart'. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. cart.js(15,6): error TS2339: Property 'total' does not exist on type 'typeof Cart'. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. cart.js(15,6): error TS2339: Property 'total' does not exist on type 'typeof Cart'. checked 21 October 2026
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'.
@memberof does not attach a function to an object.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}
cart.js cart.ts TypeScript 5.9.3 TypeScript 5.9.3, run 21 October 2026: No errors. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. No errors. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. No errors. checked 21 October 2026
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());
Assigning the function is what TypeScript reads.
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.ts file instead.
  • Keep @memberof if 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

Last reviewed 20 October 2026.