diff --git a/tests/cases/compiler/genericRestTypes.ts b/tests/cases/compiler/genericRestTypes.ts new file mode 100644 index 00000000000..cdfbd54f70d --- /dev/null +++ b/tests/cases/compiler/genericRestTypes.ts @@ -0,0 +1,15 @@ +// @strict: true + +// Repro from #25793 + +// Gets the parameters of a function type as a tuple +type Parameters any> = T extends (...args: infer U) => any ? U : never; +// Removes the first element from a tuple +type Tail = ((...args: T) => any) extends ((head: any, ...tail: infer U) => any) ? U : never; + +type MyFunctionType = (foo: number, bar: string) => boolean; + +type Explicit = (...args: Tail>) => ReturnType; // (bar: string) => boolean + +type Bind1 any> = (...args: Tail>) => ReturnType; +type Generic = Bind1; // (bar: string) => boolean