Skip to content

Commit b489104

Browse files
committed
Add regression test
1 parent 5f2efc2 commit b489104

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)