@@ -41,12 +41,16 @@ var r12 = foo(i2);
41
41
var r15 = foo ( c2 ) ;
42
42
43
43
declare function id2 < T > ( x : T , y : T ) : T ;
44
+ declare function id3 < T > ( x : T , y : T , z : T ) : T ;
44
45
45
46
declare function boom < R > ( f : ( x : string , y : number ) => R ) : R ;
46
47
declare function boom2 ( f : ( x : string , y : number ) => string ) : void ;
48
+ declare function boom3 < R > ( f : ( x : string , y : number , z : R ) => R ) : R ;
47
49
48
50
boom ( id2 ) ; // Should be an error T = [string, number]
49
51
boom2 ( id2 ) ; // Should be an error T = [string, number]
52
+ boom < string | number > ( id2 ) ; // Should be OK
53
+ boom3 < string | number > ( id3 ) ; // Should be OK
50
54
51
55
declare function withNum < N extends number > ( x : N ) : N ;
52
56
declare function withString < S extends string > ( f : ( x : S ) => S ) : void ;
@@ -56,9 +60,11 @@ withString(withNum); // Error
56
60
useString ( withNum ) ; // Error
57
61
58
62
declare function okay < R > ( f : ( x : 1 , y : number ) => R ) : R ;
63
+ declare function okay2 ( f : ( x : string , y : number ) => string | number ) ;
59
64
declare function transitive < T > ( x : T , f : ( x : T ) => T ) : void ;
60
65
61
66
okay ( id2 ) ;
67
+ okay2 ( id2 ) ;
62
68
63
69
transitive ( 1 , withNum ) ;
64
70
transitive ( '1' , withNum ) ;
0 commit comments