Repository navigation
Suggest the ES2015 library for missing Symbol references - #65473
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Open
Jake Bailey (jakebailey) wants to merge 1 commit into
Jake Bailey (jakebailey) wants to merge 1 commit into
Conversation
The missing-library hint matches source identifier text. The spelling ast.Symbol can never match the global Symbol identifier, so missing Symbol references fall back to generic name and shorthand errors. Match Symbol itself so value, shorthand, and type references receive the existing ES2015 library guidance.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the Symbol diagnostic fix.
No open issues 🎉
What changed in this PR
Fixes the native TypeScript checker so unresolved Symbol references suggest enabling the ES2015 library or later.
Changes:
- Corrects the diagnostic lookup from
"ast.Symbol"to"Symbol". - Adds a regression test covering value, shorthand-property, and type references, with diagnostic, emit, type, and symbol baselines.
| File | Description |
|---|---|
tsc/testdata/tests/cases/compiler/missingSymbolLibraryDiagnostic.ts |
Tests missing Symbol references without built-in libraries. |
tsc/testdata/baselines/reference/compiler/missingSymbolLibraryDiagnostic.types |
Records expected type information. |
tsc/testdata/baselines/reference/compiler/missingSymbolLibraryDiagnostic.symbols |
Records expected symbol information. |
tsc/testdata/baselines/reference/compiler/missingSymbolLibraryDiagnostic.js |
Records expected JavaScript output. |
tsc/testdata/baselines/reference/compiler/missingSymbolLibraryDiagnostic.errors.txt |
Captures the ES2015 library suggestion for all three references. |
tsc/internal/checker/checker.go |
Routes unresolved Symbol names to the library-suggestion diagnostic. |
Review effort: Balanced
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.
This is a funny oops. Probably a find and replace.