Open
Description
π 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
π» Code
type Data = [a: 1, b: 2, ...c: 3[]]
type TestType1<T extends any[]> =
T extends [...infer R extends [any, any], ...any[]] ? R : never
type test1 = TestType1<Data>
// ^?
type TestType2<T extends any[], Mask extends any[] = [any, any]> =
T extends [...infer R extends Mask, ...any[]] ? R : never
type test2 = 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