Bug Report
Unlikely this hasn't been already mentioned before, but i couldn't find anything.
A mapped type using string keys which represent numbers displays these as numbers in the tooltip.
type A = { [K in '0']: number }; // { 0: number }
type B = { '0': number }; // { '0': number }
type C = { 0: number }; // { 0: number }
type Atest = '0' extends keyof A ? 'yes' : 'no'; // 'yes'
🔎 Search Terms
mapped type tooltip displays number string key
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about #common-bugs-that-arent-bugs
⏯ Playground Link
Playground link with relevant code
🙁 Actual behavior
Tooltip displays
🙂 Expected behavior
Tooltip displays
type A = {
'0': number;
}
PS: I'd prefer it even more, if TS stopped allowing keys being some subtype of number altogether, but i guess that's a different topic.
Bug Report
Unlikely this hasn't been already mentioned before, but i couldn't find anything.
A mapped type using string keys which represent numbers displays these as numbers in the tooltip.
🔎 Search Terms
mapped type tooltip displays number string key
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
🙁 Actual behavior
Tooltip displays
🙂 Expected behavior
Tooltip displays
PS: I'd prefer it even more, if TS stopped allowing keys being some subtype of
numberaltogether, but i guess that's a different topic.