Parse dotted private names in type queries, forbid in declaration emit - #4898
Conversation
|
It looks like this revives the approach from microsoft/TypeScript#47696 while addressing the AST issue that led to its revert. I was wondering whether it still makes sense to consider the approach from microsoft/TypeScript#47595 (comment)? |
|
Private names only appear in dotted expression-like positions elsewhere in the language, I really don't wanna go changing that. If we had |
There was a problem hiding this comment.
Pull request overview
Enables private identifiers in dotted type queries while preventing invalid declaration emission.
Changes:
- Parses and prints private names in
typeofqueries. - Extends qualified-name AST support to member names.
- Adds TS7080 declaration diagnostics and compiler baselines.
Show a summary per file
| File | Description |
|---|---|
_scripts/ast.json |
Widens qualified-name suffixes. |
_packages/native-preview/src/ast/ast.generated.ts |
Updates AST typing. |
_packages/native-preview/src/ast/factory.generated.ts |
Updates factory signatures. |
_packages/native-preview/src/ast/visitor.generated.ts |
Visits member names. |
internal/ast/ast_generated.go |
Updates Go AST definitions. |
internal/parser/parser.go |
Parses private type-query names. |
internal/printer/printer.go |
Prints private qualified names. |
internal/transformers/declarations/transform.go |
Rejects private declaration references. |
internal/diagnostics/extraDiagnosticMessages.json |
Defines TS7080. |
internal/diagnostics/diagnostics_generated.go |
Generates TS7080 metadata. |
testdata/tests/cases/compiler/privateNameInTypeQuery.ts |
Tests parsing and checking. |
testdata/tests/cases/compiler/declarationEmitPrivateNameInTypeQuery.ts |
Tests declaration diagnostics. |
testdata/baselines/reference/compiler/privateNameInTypeQuery.types |
Records inferred types. |
testdata/baselines/reference/compiler/privateNameInTypeQuery.symbols |
Records resolved symbols. |
testdata/baselines/reference/compiler/privateNameInTypeQuery.js |
Records JavaScript output. |
testdata/baselines/reference/compiler/privateNameInTypeQuery.errors.txt |
Records expected errors. |
testdata/baselines/reference/compiler/declarationEmitPrivateNameInTypeQuery.types |
Records declaration-test types. |
testdata/baselines/reference/compiler/declarationEmitPrivateNameInTypeQuery.symbols |
Records declaration-test symbols. |
testdata/baselines/reference/compiler/declarationEmitPrivateNameInTypeQuery.js |
Records declaration-test output. |
testdata/baselines/reference/compiler/declarationEmitPrivateNameInTypeQuery.errors.txt |
Records TS7080 diagnostics. |
Review details
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Files not reviewed (2)
- internal/ast/ast_generated.go: Generated file
- internal/diagnostics/diagnostics_generated.go: Generated file
- Files reviewed: 18/20 changed files
- Comments generated: 1
- Review effort level: Balanced
Sure, why not, only affects semantic tokens though Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
microsoft/typescript-go#4898) Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Fixes microsoft/TypeScript#47595