Repository navigation
Use regular (non-widening) literal types for computed property names - #65659
Conversation
|
TypeScript Bot (@typescript-bot) test it |
There was a problem hiding this comment.
🟡 Changes recommended
A compiler regression test and committed baselines are still needed to verify that computed-key keyof inference preserves the original key union for const string keys and enum subsets with an unused member.
1 open issue
What changed in this PR
Addresses #64437 by making computed property names use regular, non-fresh literal types, so inferred keyof values stay narrow like those from literal property names.
Changes:
- Regularizes computed property expression types in the checker.
- Updates the expected single-member enum type display in an existing baseline.
| File | Description |
|---|---|
tsc/testdata/baselines/reference/compiler/enumComputedPropertyDeclarationEmit.types |
Updates the expected namespace enum key type display. |
tsc/internal/checker/checker.go |
Converts computed property name types to regular literal types. |
Review effort: Balanced
|
Anders Hejlsberg (@ahejlsberg) Here are the results of running the user tests with tsc comparing Everything looks good! |
|
Hey Anders Hejlsberg (@ahejlsberg), the results of running the DT tests are ready. Everything looks the same! |
|
Anders Hejlsberg (@ahejlsberg) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Anders Hejlsberg (@ahejlsberg) Here are the results of running the top 400 repos with tsc comparing Everything looks good! |

Fixes #64437.