Conversation
A mapped property keyed by a unique symbol has an internal symbol name that is not usable in source. Implementing the interface wrote that name as an identifier, which crashed the printer. The member needs a computed name referencing the symbol, along with an import when the symbol lives in another module.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Computed member fixes can omit required value imports, retain type-only bindings, or add unused imports, introducing TypeScript errors.
3 open issues
What changed in this PR
Fixes a printer crash in the language server’s “Implement interface” action for mapped properties keyed by unique symbols.
Changes:
- Generates computed member names and requests value imports for referenced symbols.
- Adds regression tests for local and directly exported unique-symbol keys.
| File | Description |
|---|---|
tsc/internal/ls/codeactions_missingmemberfixer.go |
Builds computed names and collects value imports. |
tsc/internal/fourslash/tests/codeFixClassImplementInterfaceMappedType2_test.go |
Tests local and cross-module unique-symbol members. |
Review effort: Balanced
Importing every symbol the node builder touched while naming the
unique symbol added an unused import for a name reached through a
namespace import, as with `[dep.key]` and an extra `import { key }`.
Name the symbol through a type query instead, as the fix does for type
annotations. A name already in scope is used as is, and a symbol only
reachable through an import type is imported under its exported name.
A symbol that cannot be imported is written by its declared name,
leaving an unresolved name for the user to fix.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The fix generates invalid computed class members when keys have type-only imports or are exported through export lists, leaving missing value imports and compiler errors.
2 open issues
3 resolved since last review
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.

A mapped property keyed by a unique symbol has an internal symbol name that is not usable in source. Implementing the interface wrote that name as an identifier, which crashed the printer. The member needs a computed name referencing the symbol, along with an import when the symbol lives in another module.