- Error
- Reported by the type checker
TS2305
Module '{0}' has no exported member '{1}'.
An import names something the module doesn't export. Check the spelling, or whether it is a default export.
What it means
The module resolves, but it has no export with the imported name. Typical causes are a typo, a renamed export, or importing a default export with braces.
Example
export function add(a: number, b: number) {
return a + b;
}
import { sum } from "./math";
export const three = sum(1, 2);
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(1,10): error TS2305: Module '"./math"' has no exported member 'sum'.
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.
How to fix
- Use the name the module actually exports.
- For a default export, import without braces:
import add from "./math".