Skip to content

Commit d2cc282

Browse files
committed
Add tests
1 parent 201eec6 commit d2cc282

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/cases/conformance/functions/strictBindCallApply1.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@
22

33
declare function foo(a: number, b: string): string;
44

5+
declare function overloaded(s: string): number;
6+
declare function overloaded(n: number): string;
7+
8+
declare function generic<T>(x: T): T;
9+
510
let f00 = foo.bind(undefined);
611
let f01 = foo.bind(undefined, 10);
712
let f02 = foo.bind(undefined, 10, "hello");
813
let f03 = foo.bind(undefined, 10, 20); // Error
914

15+
let f04 = overloaded.bind(undefined); // typeof overloaded
16+
let f05 = generic.bind(undefined); // typeof generic
17+
1018
let c00 = foo.call(undefined, 10, "hello");
1119
let c01 = foo.call(undefined, 10); // Error
1220
let c02 = foo.call(undefined, 10, 20); // Error
@@ -20,6 +28,10 @@ let a03 = foo.apply(undefined, [10, "hello", 30]); // Error
2028
class C {
2129
constructor(a: number, b: string) {}
2230
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 }
2335
}
2436

2537
declare let c: C;
@@ -31,6 +43,9 @@ let f12 = c.foo.bind(c, 10, "hello");
3143
let f13 = c.foo.bind(c, 10, 20); // Error
3244
let f14 = c.foo.bind(undefined); // Error
3345

46+
let f15 = c.overloaded.bind(c); // typeof C.prototype.overloaded
47+
let f16 = c.generic.bind(c); // typeof C.prototype.generic
48+
3449
let c10 = c.foo.call(c, 10, "hello");
3550
let c11 = c.foo.call(c, 10); // Error
3651
let c12 = c.foo.call(c, 10, 20); // Error

0 commit comments

Comments
 (0)