Bug Report
🔎 Search Terms
Variadic tuple mapped type keyof
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
Playground link with relevant code
💻 Code
type Keys<O extends unknown[]> = { [K in keyof O]: K };
type A = Keys<[string, ...string[]]>;
type B = Keys<[string, ...string[], number]>;
🙁 Actual behavior
A and B both have the variadic part typed as ..."1"[], which is wrong. B is further wrong because the number part becomes "2", while in practice it would rarely be "2".
🙂 Expected behavior
A should be ["0", ...number[]]; B should be ["0", ...number[], number]
Bug Report
🔎 Search Terms
Variadic tuple mapped type keyof
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
AandBboth have the variadic part typed as..."1"[], which is wrong.Bis further wrong because thenumberpart becomes"2", while in practice it would rarely be"2".🙂 Expected behavior
Ashould be["0", ...number[]];Bshould be["0", ...number[], number]