Numeric string key is being converted to a number in declaration file #50358
Labels
Fix Available
A PR has been opened for this issue
Needs Investigation
This issue needs a team member to investigate its status.
Milestone
Bug Report
When TS converts a specific type into a static type in a
d.ts
file, it's converting numeric string keys into a number, e.g.'1'
becomes1
. It seems similar to the issue described here, but my value is being re-mapped with generics and mapped types, so it seems like it's a more complicated version of this. The.d.ts
tab in the playground link shows what is happening.🔎 Search Terms
numeric string key converted to number
🕗 Version & Regression Information
TS 4.7.4
⏯ Playground Link
Playground link with relevant code
💻 Code
It's an issue with compilation, the playground link above shows it.
🙁 Actual behavior
Conversion of a specific type with mapped keys to a static type is resulting in string numeric keys being converted to numbers. e.g.
'0'
,'1'
, getting converted to1
,2
.🙂 Expected behavior
Keys to remain as strings and not be converted to a number.
The text was updated successfully, but these errors were encountered: