Repository navigation
Don't let TypeQuery have PropertyAccessExpression as ExprName - #65501
Closed
Jake Bailey (jakebailey) wants to merge 1 commit into
Closed
Jake Bailey (jakebailey) wants to merge 1 commit into
Jake Bailey (jakebailey) wants to merge 1 commit into
Conversation
Qualified annotation names and instantiated symbol chains could place property access expressions in TypeQuery.ExprName. Identical printed spellings concealed those malformed children. Convert annotation expression chains and normalize checker query names, keeping type arguments after the complete name. Require entity names in the printer once both producers supply them. Keep the qualified object-spread codefix text unchanged.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the type-query entity-name changes.
No open issues 🎉
What changed in this PR
This PR enforces valid entity names in TypeQuery nodes in the native TypeScript compiler and language server, replacing property-access expressions with qualified names.
Changes:
- Adds an expression-to-entity-name helper and uses it when constructing type queries.
- Removes the printer workaround and keeps type-query arguments after the complete entity name.
- Adds a fourslash regression test for annotating a qualified object spread.
| File | Description |
|---|---|
tsc/internal/printer/printer.go |
Removes property-access handling from entity-name printing. |
tsc/internal/printer/factory.go |
Adds recursive conversion from expressions to entity names. |
tsc/internal/ls/codeactions_fixmissingtypeannotation.go |
Uses the helper for typeof annotations. |
tsc/internal/fourslash/tests/codeFixMissingTypeAnnotationOnExports34-object-spread_test.go |
Tests annotation of a nested namespace object spread. |
tsc/internal/checker/nodebuilderimpl.go |
Constructs valid type-query entity names and adjusts type-argument placement. |
Review effort: Balanced
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 another AST node type violation. Instead of sticking a property access in here, just write the code that actually converts it into an entity name.