🔎 Search Terms
generic, tuple extends
🕗 Version & Regression Information
This code works in the playground with typescript version 5.3.3 but breaks since version 5.4.5 (version between are not available in the playground)
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.6.3#code/C4TwDgpgBAIghsOUC8UDacBcUCMAaKAI2wCYCA6SgY2wGY0BdBgWACg3RIoAVCAZ2DdwEHAB5uUCAA9gEAHYATPlDhyQjAHwoobKHp6SZ8pekrkAlnIBmEAE5QASodmLlGNQVUgGFSl8YMUAD8jlDYchAAbnYcwlCyAjjavAJCkGLwiBpsAPQ5+gB6QWyxXCmCwiTizsbK-j5QALJwfADWNa4qaoza7iCeagxaqLr6EtIuJmhmljb2ThO1TS2tvuT1gSFO4VExrJzQCcAkyfwVkFWZcNmseYVBQA
💻 Code
typeData=[a: 1,b: 2, ...c: 3[]]typeTestType1<Textendsany[]>=Textends[...infer Rextends[any,any], ...any[]] ? R : nevertypetest1=TestType1<Data>// ^?typeTestType2<Textendsany[],Maskextendsany[]=[any,any]>=Textends[...infer RextendsMask, ...any[]] ? R : nevertypetest2=TestType2<Data>// ^?
🙁 Actual behavior
When passing the Mask as a generic and trying to extends the tuple with it to extract the relevant part, the resulting tuple is well formed, but item types are replaced with any
🙂 Expected behavior
Expect that constraint on infer to works wether as an explicit form or a generic holding a type with the exact same form, which used to be the case priori to typescript 5.4 bu breaks since
Additional information about the issue
No response
🔎 Search Terms
generic, tuple extends
🕗 Version & Regression Information
This code works in the playground with typescript version 5.3.3 but breaks since version 5.4.5 (version between are not available in the playground)
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.6.3#code/C4TwDgpgBAIghsOUC8UDacBcUCMAaKAI2wCYCA6SgY2wGY0BdBgWACg3RIoAVCAZ2DdwEHAB5uUCAA9gEAHYATPlDhyQjAHwoobKHp6SZ8pekrkAlnIBmEAE5QASodmLlGNQVUgGFSl8YMUAD8jlDYchAAbnYcwlCyAjjavAJCkGLwiBpsAPQ5+gB6QWyxXCmCwiTizsbK-j5QALJwfADWNa4qaoza7iCeagxaqLr6EtIuJmhmljb2ThO1TS2tvuT1gSFO4VExrJzQCcAkyfwVkFWZcNmseYVBQA
💻 Code
🙁 Actual behavior
When passing the
Maskas a generic and trying to extends the tuple with it to extract the relevant part, the resulting tuple is well formed, but item types are replaced withany🙂 Expected behavior
Expect that constraint on infer to works wether as an explicit form or a generic holding a type with the exact same form, which used to be the case priori to typescript 5.4 bu breaks since
Additional information about the issue
No response