Skip to content

Referenced project options not consulted to determine .d.ts format for synthetic default export eligibility #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

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions