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
| Code | TS2305 |
|---|---|
| Message | Module '{0}' has no exported member '{1}'. |
Also on this page: TS2724 | '{0}' has no exported member named '{1}'. Did you mean '{2}'? |
| TypeScript's category | error |
| Listed under | Modules 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
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)}`;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.
import { formatDate, formatPrice } from "./format.js";
export const line = `${formatDate(new Date())} ${formatPrice(1999)}`;jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": ["*.js"]
} Gotchas
- In a
.jsmodule every top-level@typedefis exported too, so a typedef can be imported by name with@import. A type imported in a regularimportstatement is a different error (TS18042), because a JavaScript import has to name a value.
Sources
- Modules Reference · TypeScript handbook
- import · MDN Web Docs
- diagnosticMessages.json (TypeScript 5.9.3) · TypeScript on GitHub
Last reviewed 20 October 2026.