File: genericInterfaceTypeCall.js

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (21 lines) | stat: -rw-r--r-- 627 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//// [genericInterfaceTypeCall.ts]
interface Foo<T> {
    reject(arg: T): void;
}
var foo: Foo<string>
 
interface bar<T> {
    fail(func: (arg: T) => void ): void;
    fail2(func2: { (arg: T): void; }): void;
}
var test: bar<string>;
 
test.fail(arg => foo.reject(arg));
test.fail2(arg => foo.reject(arg)); // Error: Supplied parameters do not match any signature of call target


//// [genericInterfaceTypeCall.js]
var foo;
var test;
test.fail(function (arg) { return foo.reject(arg); });
test.fail2(function (arg) { return foo.reject(arg); }); // Error: Supplied parameters do not match any signature of call target