File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments