-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
30 lines (26 loc) · 784 Bytes
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
let items = [1, 2, 3];
items.forEach(arg => console.log(arg));
items.forEach( () => console.log("Counting"));
function handler(arg: string) {
console.log(arg)
}
function doSomething(callback: (arg1: string, arg2: number) => void) {
callback('hello', 42);
}
// Expected error because 'doSomething' wants a callback of
// 2 parameters, but 'handler' only accepts 1
doSomething(handler);
// Original example why I get interested in this problem
interface I {
hi(a: string, b: string): void;
}
class A implements I {
hi(a: string, b: string, c: string): void {
throw new Error("Method not implemented." + a);
}
}
class B implements I {
hi(a: string): void {
throw new Error("Method not implemented." + a);
}
}