Repository navigation
Preserve non-module errors for imports without attributes - #64884
Merged
Gabriela Araujo Britto (gabritto) merged 2 commits intoOct 26, 2026
Merged
Gabriela Araujo Britto (gabritto) merged 2 commits into
Gabriela Araujo Britto (gabritto) merged 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The narrow guard restores the intended resolution order, with matching regression coverage and no identified blocking issues.
No open issues 🎉
What changed in this PR
Restores TS2306 diagnostics when imports without attributes resolve to non-module files, addressing #64882 while preserving attribute-based ambient module resolution.
Changes:
- Guards pattern ambient fallback for resolved scripts.
- Adds regression tests and diagnostic baselines covering resolution paths, empty attributes, and empty modules.
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/patternAmbientModuleResolvedScriptWithoutPaths.ts |
Tests resolution without path mappings. |
tsc/testdata/tests/cases/compiler/patternAmbientModuleResolvedScript.ts |
Tests resolved scripts and attribute precedence. |
tsc/testdata/tests/cases/compiler/patternAmbientModuleResolvedEmptyModule.ts |
Tests empty-module resolution precedence. |
tsc/testdata/baselines/reference/compiler/patternAmbientModuleResolvedScriptWithoutPaths.errors.txt |
Records diagnostics without path mappings. |
tsc/testdata/baselines/reference/compiler/patternAmbientModuleResolvedScript.errors.txt |
Records restored non-module errors. |
tsc/testdata/baselines/reference/compiler/patternAmbientModuleResolvedEmptyModule.errors.txt |
Records empty-module diagnostics. |
tsc/internal/checker/checker.go |
Limits resolved-script fallback to nonempty attributes. |
Review effort: Balanced
Jake Bailey (jakebailey)
requested a review
from Andrew Branch (andrewbranch)
October 20, 2026 16:50
Andrew Branch (andrewbranch)
approved these changes
Oct 20, 2026
Harsh Mandan (harshmandan)
added a commit
to harshmandan/svelte-check-native
that referenced
this pull request
Oct 27, 2026
First nightly with the TS2306 ordering restored (built from 49e69830, the merge of microsoft/TypeScript#64884 for #64882): an import that resolves to a non-module file reports TS2306 again instead of falling back to a pattern ambient module. Fixtures 502 and 503 pass, and the full suite is green (1293 passed, 0 failed).
Harsh Mandan (harshmandan)
added a commit
to harshmandan/svelte-check-native
that referenced
this pull request
Oct 27, 2026
First nightly with the TS2306 ordering restored (built from 49e69830, the merge of microsoft/TypeScript#64884 for #64882): an import that resolves to a non-module file reports TS2306 again instead of falling back to a pattern ambient module. Fixtures 502 and 503 pass, and the full suite is green (1293 passed, 0 failed).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #64882
fixes a, what seems to be an unintended, behavioral change from #63931 , given this statement from that PR:
cc Gabriela Araujo Britto (@gabritto)