Repository navigation
Stop alias deprecation walks at declaration-free targets - #65484
Open
Marc Rousavy (mrousavy) wants to merge 2 commits into
Open
Marc Rousavy (mrousavy) wants to merge 2 commits into
Marc Rousavy (mrousavy) wants to merge 2 commits into
Conversation
Author
|
@microsoft-github-policy-service agree |
Marc Rousavy (mrousavy)
marked this pull request as ready for review
November 13, 2026 11:39
Contributor
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the fix to the checker hang during CommonJS namespace resolution.
No open issues 🎉
What changed in this PR
Fixes a native TypeScript checker hang when resolving a namespace imported from a CommonJS module that exports undefined.
Changes:
- Stops alias deprecation walks at declaration-free targets while preserving the resolved namespace.
- Adds reduced, cyclic-import, and unused-namespace compiler fixtures with type and symbol baselines.
- Adds a checker control test for declared-alias deprecation suggestions and TS2322 diagnostics.
| File | Description |
|---|---|
tsc/internal/checker/checker.go |
Terminates alias walks when the target has no declarations. |
tsc/internal/checker/alias_terminal_test.go |
Checks declared-alias deprecations and an assignment type error. |
tsc/testdata/tests/cases/compiler/aliasToDeclarationFreeUndefined.ts |
Adds the minimal hang regression. |
tsc/testdata/tests/cases/compiler/aliasToDeclarationFreeUndefinedCycle.ts |
Covers the original cyclic-import scenario. |
tsc/testdata/tests/cases/compiler/aliasToDeclarationFreeUndefinedUnused.ts |
Adds an unused-namespace control. |
tsc/testdata/baselines/reference/compiler/aliasToDeclarationFreeUndefined.types |
Records the reduced case’s namespace and return types. |
tsc/testdata/baselines/reference/compiler/aliasToDeclarationFreeUndefined.symbols |
Records symbol resolution for the reduced case. |
tsc/testdata/baselines/reference/compiler/aliasToDeclarationFreeUndefinedCycle.types |
Records inferred types across the import cycle. |
tsc/testdata/baselines/reference/compiler/aliasToDeclarationFreeUndefinedCycle.symbols |
Records symbol resolution across the import cycle. |
tsc/testdata/baselines/reference/compiler/aliasToDeclarationFreeUndefinedUnused.types |
Records types for the unused-namespace control. |
tsc/testdata/baselines/reference/compiler/aliasToDeclarationFreeUndefinedUnused.symbols |
Records symbols for the unused-namespace control. |
Review effort: Balanced
Drop the Go unit test and the cycle and unused fixtures. The remaining compiler test uses harness options instead of a tsconfig. Deprecation walks through re-exports stay covered by jsdocDeprecated_suggestion*.
This branch has not been deployed
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 a checker hang when a function returns a namespace imported from a CommonJS module whose export is
undefined:In
resolveAliasWithDeprecationCheck, the immediate alias target here has no declarations (the intrinsicundefinedsymbol). That branch neither advancessymbolnor breaks, so the loop never ends. The walk now only continues when the target has declarations and breaks otherwise.The test is
compiler/aliasToDeclarationFreeUndefined.ts. Without the fix it times out inresolveAliasWithDeprecationCheck. The existingjsdocDeprecated_suggestion*fourslash tests cover deprecation suggestions through re-exports and still pass.AI assistance was used to investigate and prepare this patch.