-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Description
π Search Terms
- default import has no default export
- missing default export not reported
- default import from named exports only
- should error: module has no default export
- no diagnostic for default import
- checker fails default import
- moduleResolution bundler default import
- bundler resolution default import missing
- TypeScript no error default import
- TS1192 Module has no default export not emitted
- TS1192 not raised with bundler
- TS2307 repro default import (historical term)
- composite project default import diagnostic
- monorepo workspace default import diagnostic
π Version & Regression Information
This is the behavior in every version I tried (TypeScript 5.9.2 and typescript@next as of 2025β08β09)
β― Playground Link
https://github.com/dBianchii/ts2307-repro
π» Code
// strict: true
// target: ES2022
// module: ESNext
// moduleResolution: bundler
// verbatimModuleSyntax: true
// allowSyntheticDefaultImports: false
// esModuleInterop: true
// filename: a.ts
export const test = () => "test";
// filename: b.ts
import Test from "./a"; // should error: module './a' has no default export
console.log(Test.test());
π Actual behavior
pnpm -F @ts2307-repro/b typecheck
(or just running tsc --build
or even just tsc
) completes with exit code 0 and no diagnostics, even though @ts2307-repro/b does a default import from a module that only has named exports.
π Expected behavior
TypeScript should emit an error for the default import because ./a (or @ts2307-repro/a/src/Utils) has no default export.
The build should fail (nonβzero exit) under moduleResolution: bundler.
Additional information about the issue
Repros on macOS (Darwin 26.0 pnpm 10.13.1, TypeScript 5.9.2 and typescript@next (as of today).
Metadata
Metadata
Assignees
Labels
No labels