JSDoc tag

@module

  • Not checked by TypeScript
  • Tested with TypeScript 5.9

@module inventory is a JSDoc documentation tag that names a file's module in the documentation that the JSDoc tool builds. TypeScript 5.9 does not act on it: importing "inventory" from another file still fails to resolve, because TypeScript finds modules by path and by package name, never by tag.

The tag is harmless documentation. To make a module importable by a bare name, publish it as a package (or a workspace package), map it with paths, or describe it with declare module in a .d.ts file.

At a glance

Use JSDoc in a .js file TypeScript in a .ts file
Importing a module import { stock } from "./inventory.js"; import { stock } from "./inventory.js";
Naming a module for consumers // a .d.ts file declare module "inventory" { … } declare module "inventory" { … }

Examples

report.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: report.js(2,23): error TS2307: Cannot find module 'inventory' or its corresponding type declarations. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. report.js(2,23): error TS2307: Cannot find module 'inventory' or its corresponding type declarations. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. report.js(2,23): error TS2307: Cannot find module 'inventory' or its corresponding type declarations. checked 21 October 2026
import { stock } from "inventory";error TS2307: Cannot find module 'inventory' or its corresponding type declarations.

export const message = `${stock} in stock`;
@module does not give a file a module name.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}
report.js 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
import { stock } from "./inventory.js";

export const message = `${stock} in stock`;
Modules are imported by path.
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 puts @module inventory in inventory.js and imports "inventory" from a second file. tsc reports TS2307 ("Cannot find module 'inventory' or its corresponding type declarations"). The second example imports "./inventory.js" by path and passes, with the tag still in place.

Where module names come from

A relative specifier (./inventory.js) is a path. A bare specifier (inventory) is looked up in node_modules through package.json, or in paths if the config maps it. With module: nodenext, relative imports in ES modules need the file extension, just as Node.js does at run time.

Gotchas

  • Do not confuse @module with the module and moduleDetection options in jsconfig.json; those decide how files are treated, not what they are called.

Questions

Does @module change how TypeScript resolves imports?

No. TypeScript 5.9 resolves imports from the path or package name only; @module is shown in hovers and otherwise ignored.

Sources

Last reviewed 20 October 2026.