TypeScript error

TS2305: Importing a name the module does not export

  • Error TS2305
  • Tested with TypeScript 5.9

error TS2305: Module '"./format.js"' has no exported member 'formatDate'. is reported for import { formatDate } from "./format.js" when format.js exports no formatDate. If an export with a similar name exists, the error is TS2724 instead and suggests it: '"./format.js"' has no exported member named 'formatPrise'. Did you mean 'formatPrice'?

At run time in Node.js the same import fails before any code runs (SyntaxError: The requested module './format.js' does not provide an export named 'formatDate'), so the checker is reporting a real crash early.

At a glance

CodeTS2305
MessageModule '{0}' has no exported member '{1}'.
Also on this page: TS2724 '{0}' has no exported member named '{1}'. Did you mean '{2}'?
TypeScript's categoryerror
Listed underModules and imports
Turned on by No option: every checked file reports it
In .js files Reported when the file is checked: checkJs in jsconfig.json, or // @ts-check at the top of the file

The messages are TypeScript's own text from its diagnostic messages file (Apache-2.0); {0}, {1} and {2} are filled in by tsc for each error.

What it looks like

cart.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: cart.js(2,10): error TS2305: Module '"./format.js"' has no exported member 'formatDate'. cart.js(4,10): error TS2724: '"./format.js"' has no exported member named 'formatPrise'. Did you mean 'formatPrice'? 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. cart.js(2,10): error TS2305: Module '"./format.js"' has no exported member 'formatDate'. cart.js(4,10): error TS2724: '"./format.js"' has no exported member named 'formatPrise'. Did you mean 'formatPrice'? 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. cart.js(2,10): error TS2305: Module '"./format.js"' has no exported member 'formatDate'. cart.js(4,10): error TS2724: '"./format.js"' has no exported member named 'formatPrise'. Did you mean 'formatPrice'? checked 21 October 2026
import { formatDate } from "./format.js";error TS2305: Module '"./format.js"' has no exported member 'formatDate'.
import { formatPrise } from "./format.js";error TS2724: '"./format.js"' has no exported member named 'formatPrise'. Did you mean 'formatPrice'?

export const line = `${formatDate(new Date())} ${formatPrise(1999)}`;
Importing a name the module does not export, and a near miss.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}

What causes it

  • The name is misspelled (TS2724 when the checker can suggest the right one).
  • The function exists but was never exported, or was renamed in the module.
  • The module exports it as its default export; that case has its own message, TS2614.

How to fix it

Import a name the module exports, or export it

Fix the spelling, or add export to the function in the module. In the editor, completions inside the braces of an import list the module's exports.

cart.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 { formatDate, formatPrice } from "./format.js";

export const line = `${formatDate(new Date())} ${formatPrice(1999)}`;
Import what the module exports, and export what you import.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": ["*.js"]
}

Gotchas

  • In a .js module every top-level @typedef is exported too, so a typedef can be imported by name with @import. A type imported in a regular import statement is a different error (TS18042), because a JavaScript import has to name a value.

Sources

Last reviewed 20 October 2026.