Registry Mirror
Skip to content

Conversation

@jakebailey

Copy link
Copy Markdown
Member

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.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants