2
2
3
3
declare function foo ( a : number , b : string ) : string ;
4
4
5
+ declare function overloaded ( s : string ) : number ;
6
+ declare function overloaded ( n : number ) : string ;
7
+
8
+ declare function generic < T > ( x : T ) : T ;
9
+
5
10
let f00 = foo . bind ( undefined ) ;
6
11
let f01 = foo . bind ( undefined , 10 ) ;
7
12
let f02 = foo . bind ( undefined , 10 , "hello" ) ;
8
13
let f03 = foo . bind ( undefined , 10 , 20 ) ; // Error
9
14
15
+ let f04 = overloaded . bind ( undefined ) ; // typeof overloaded
16
+ let f05 = generic . bind ( undefined ) ; // typeof generic
17
+
10
18
let c00 = foo . call ( undefined , 10 , "hello" ) ;
11
19
let c01 = foo . call ( undefined , 10 ) ; // Error
12
20
let c02 = foo . call ( undefined , 10 , 20 ) ; // Error
@@ -20,6 +28,10 @@ let a03 = foo.apply(undefined, [10, "hello", 30]); // Error
20
28
class C {
21
29
constructor ( a : number , b : string ) { }
22
30
foo ( this : this, a : number , b : string ) : string { return "" }
31
+ overloaded ( s : string ) : number ;
32
+ overloaded ( n : number ) : string ;
33
+ overloaded ( x : any ) : any { return < any > undefined }
34
+ generic < T > ( x : T ) : T { return x }
23
35
}
24
36
25
37
declare let c : C ;
@@ -31,6 +43,9 @@ let f12 = c.foo.bind(c, 10, "hello");
31
43
let f13 = c . foo . bind ( c , 10 , 20 ) ; // Error
32
44
let f14 = c . foo . bind ( undefined ) ; // Error
33
45
46
+ let f15 = c . overloaded . bind ( c ) ; // typeof C.prototype.overloaded
47
+ let f16 = c . generic . bind ( c ) ; // typeof C.prototype.generic
48
+
34
49
let c10 = c . foo . call ( c , 10 , "hello" ) ;
35
50
let c11 = c . foo . call ( c , 10 ) ; // Error
36
51
let c12 = c . foo . call ( c , 10 , 20 ) ; // Error
0 commit comments