Skip to content

checker: Default import not flagged when target has no default export (moduleResolution=bundler)” #62241

@dBianchii

Description

@dBianchii

πŸ”Ž 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions