Skip to content

fix(64627): reject deferred imports without namespace bindings - #64640

Open
Oleksandr Tarasiuk (a-tarasyuk) wants to merge 2 commits into
microsoft:mainfrom
a-tarasyuk:fix/64627
Open

Oleksandr Tarasiuk (a-tarasyuk) wants to merge 2 commits into
microsoft:mainfrom
a-tarasyuk:fix/64627

Conversation

@a-tarasyuk

Copy link
Copy Markdown
Contributor

Fixes #64627

Copilot AI balanced review requested due to automatic review settings October 5, 2026 10:32
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Oct 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new diagnostic is filtered out for ordinary JavaScript files when checkJs is unset.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
What changed in this PR

Addresses #64627 by preserving deferred import clauses without bindings so the compiler can report a namespace-binding error.

Changes:

  • Retains empty deferred import clauses and adds TS18116.
  • Simplifies default-import helper detection.
  • Expands TypeScript and JavaScript coverage across ESNext and CommonJS.
File Description
tsc/​testdata/​tests/​cases/​conformance/​importDefer/​importDeferInvalidDefault.ts Adds missing-binding cases and module variants.
tsc/​testdata/​baselines/​reference/​conformance/​importDeferInvalidDefault(module=esnext).types Records ESNext types.
tsc/​testdata/​baselines/​reference/​conformance/​importDeferInvalidDefault(module=esnext).symbols Records ESNext symbols.
tsc/​testdata/​baselines/​reference/​conformance/​importDeferInvalidDefault(module=esnext).js Updates ESNext emit expectations.
tsc/​testdata/​baselines/​reference/​conformance/​importDeferInvalidDefault(module=esnext).errors.txt Records ESNext diagnostics.
tsc/​testdata/​baselines/​reference/​conformance/​importDeferInvalidDefault(module=commonjs).types Updates CommonJS types.
tsc/​testdata/​baselines/​reference/​conformance/​importDeferInvalidDefault(module=commonjs).symbols Updates CommonJS symbols.
tsc/​testdata/​baselines/​reference/​conformance/​importDeferInvalidDefault(module=commonjs).js Records CommonJS emit expectations.
tsc/​testdata/​baselines/​reference/​conformance/​importDeferInvalidDefault(module=commonjs).errors.txt Records CommonJS diagnostics.
tsc/​testdata/​baselines/​reference/​conformance/​importDeferInvalidDefault.errors.txt Removes the unparameterized diagnostic baseline.
tsc/​internal/​transformers/​moduletransforms/​externalmoduleinfo.go Simplifies default-helper detection.
tsc/​internal/​parser/​parser.go Preserves empty deferred import clauses.
tsc/​internal/​diagnostics/​diagnostics_generated.go Registers TS18116.
tsc/​internal/​diagnostics/​diagnosticMessages.json Defines the namespace-binding diagnostic.
tsc/​internal/​diagnostics/​diagnosticMessages.generated.json Adds the generated diagnostic message.
tsc/​internal/​checker/​grammarchecks.go Rejects deferred imports without bindings.
Files not reviewed (1)
  • tsc/internal/diagnostics/diagnostics_generated.go: Generated file

Comment thread tsc/internal/checker/grammarchecks.go

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused parser and diagnostic changes have matching regression baselines, with no unresolved blocking issues.

Review effort: Balanced
Findings: None

Resolved since last review (1)
Files not reviewed (1)
  • tsc/internal/diagnostics/diagnostics_generated.go: Generated file

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Needs merge

Development

Successfully merging this pull request may close these issues.

import defer "./a.js" is accepted without an error, and the output drops defer

3 participants