Add tests

This commit is contained in:
Anders Hejlsberg
2019-02-19 07:02:50 -10:00
parent 451f65332c
commit f19191b081

View File

@@ -59,6 +59,21 @@ function f4<T extends any[]>(t: T) {
f((a, b, ...x) => {});
}
declare function f5<T extends any[], U>(f: (...args: T) => U): (...args: T) => U;
let g0 = f5(() => "hello");
let g1 = f5((x, y) => 42);
let g2 = f5((x: number, y) => 42);
let g3 = f5((x: number, y: number) => x + y);
let g4 = f5((...args) => true);
declare function pipe<A extends any[], B, C>(f: (...args: A) => B, g: (x: B) => C): (...args: A) => C;
let g5 = pipe(() => true, b => 42);
let g6 = pipe(x => "hello", s => s.length);
let g7 = pipe((x, y) => 42, x => "" + x);
let g8 = pipe((x: number, y: string) => 42, x => "" + x);
// Repro from #25288
declare var tuple: [number, string];