We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5f2efc2 commit b489104Copy full SHA for b489104
1 file changed
tests/cases/compiler/genericRestTypes.ts
@@ -0,0 +1,15 @@
1
+// @strict: true
2
+
3
+// Repro from #25793
4
5
+// Gets the parameters of a function type as a tuple
6
+type Parameters<T extends (...args: any[]) => any> = T extends (...args: infer U) => any ? U : never;
7
+// Removes the first element from a tuple
8
+type Tail<T extends any[]> = ((...args: T) => any) extends ((head: any, ...tail: infer U) => any) ? U : never;
9
10
+type MyFunctionType = (foo: number, bar: string) => boolean;
11
12
+type Explicit = (...args: Tail<Parameters<MyFunctionType>>) => ReturnType<MyFunctionType>; // (bar: string) => boolean
13
14
+type Bind1<T extends (head: any, ...tail: any[]) => any> = (...args: Tail<Parameters<T>>) => ReturnType<T>;
15
+type Generic = Bind1<MyFunctionType>; // (bar: string) => boolean
0 commit comments