JSDoc tag

@implements

  • Checked by TypeScript
  • Tested with TypeScript 5.9

@implements {Store} above a class asks TypeScript to check that the class provides every member of Store with compatible types. A missing or mistyped member is an error on the class (TS2420), exactly as with implements in a .ts file.

The type usually comes from a @typedef with an object type, an interface in a .d.ts file, or another class. The tag adds a check; it does not change the class's own type or add anything at run time.

At a glance

Use JSDoc in a .js file TypeScript in a .ts file
A class that implements a type /** @implements {Store} */ class MemoryStore { … } class MemoryStore implements Store { … }

Examples

store.js store.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
/**
 * @typedef {object} Store
 * @property {(key: string) => Promise<string | undefined>} get
 * @property {(key: string, value: string) => Promise<void>} set
 */

/** @implements {Store} */
export class MemoryStore {
  /** @type {Map<string, string>} */
  #data = new Map();

  /** @param {string} key */
  async get(key) {
    return this.#data.get(key);
  }

  /**
   * @param {string} key
   * @param {string} value
   */
  async set(key, value) {
    this.#data.set(key, value);
  }
}
interface Store {
  get(key: string): Promise<string | undefined>;
  set(key: string, value: string): Promise<void>;
}

export class MemoryStore implements Store {
  #data = new Map<string, string>();

  async get(key: string) {
    return this.#data.get(key);
  }

  async set(key: string, value: string) {
    this.#data.set(key, value);
  }
}
A class that implements a type declared with @typedef.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}
store.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: store.js(9,14): error TS2420: Class 'MemoryStore' incorrectly implements interface 'Store'. Property 'set' is missing in type 'MemoryStore' but required in type 'Store'. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. store.js(9,14): error TS2420: Class 'MemoryStore' incorrectly implements interface 'Store'. Property 'set' is missing in type 'MemoryStore' but required in type 'Store'. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. store.js(9,14): error TS2420: Class 'MemoryStore' incorrectly implements interface 'Store'. Property 'set' is missing in type 'MemoryStore' but required in type 'Store'. checked 21 October 2026
/**
 * @typedef {object} Store
 * @property {(key: string) => Promise<string | undefined>} get
 * @property {(key: string, value: string) => Promise<void>} set
 */

/** @implements {Store} */
export class MemoryStore {error TS2420: Class 'MemoryStore' incorrectly implements interface 'Store'.
  Property 'set' is missing in type 'MemoryStore' but required in type 'Store'.
  /** @type {Map<string, string>} */
  #data = new Map();

  /** @param {string} key */
  async get(key) {
    return this.#data.get(key);
  }
}
A class missing a member of its @implements type.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}

Where the tag goes

In the JSDoc comment directly above the class keyword. Several @implements tags can share one comment when a class satisfies more than one type.

The methods still need their own @param tags: @implements checks the class against the type, but it does not give the methods their parameter types. Without them, the parameters are implicitly any.

Gotchas

  • The implements keyword is TypeScript syntax; in a .js file it is an error (TS8005).
  • A type written with @typedef {object} and @property lines can be implemented, but methods declared that way are function-typed properties; that is fine for @implements.

Questions

Can a JavaScript class implement a TypeScript interface?

Yes. Declare the interface in a .d.ts file, bring it in with @import, and put @implements {Store} on the class.

Sources

Last reviewed 20 October 2026.