2017-09-22 06:40:31 +02:00
|
|
|
// @strict: true
|
2017-10-02 21:54:04 +02:00
|
|
|
// @declaration: true
|
2017-09-22 06:40:31 +02:00
|
|
|
|
|
|
|
declare function f1<T>(f1: (x: T) => void, f2: (x: T) => void): (x: T) => void;
|
|
|
|
declare function f2<T>(obj: T, f1: (x: T) => void, f2: (x: T) => void): T;
|
|
|
|
declare function f3<T>(obj: T, f1: (x: T) => void, f2: (f: (x: T) => void) => void): T;
|
|
|
|
|
|
|
|
interface Func<T> { (x: T): void }
|
|
|
|
|
|
|
|
declare function f4<T>(f1: Func<T>, f2: Func<T>): Func<T>;
|
|
|
|
|
|
|
|
declare function fo(x: Object): void;
|
|
|
|
declare function fs(x: string): void;
|
|
|
|
declare function fx(f: (x: "def") => void): void;
|
|
|
|
|
|
|
|
const x1 = f1(fo, fs); // (x: string) => void
|
|
|
|
const x2 = f2("abc", fo, fs); // "abc"
|
|
|
|
const x3 = f3("abc", fo, fx); // "abc" | "def"
|
|
|
|
const x4 = f4(fo, fs); // Func<string>
|