From f19191b0811a7ad8245b4603aa98eba507fcbc3f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Tue, 19 Feb 2019 07:02:50 -1000 Subject: [PATCH] Add tests --- .../types/rest/restTuplesFromContextualTypes.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts b/tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts index d5623a000a2..85421a7697b 100644 --- a/tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts +++ b/tests/cases/conformance/types/rest/restTuplesFromContextualTypes.ts @@ -59,6 +59,21 @@ function f4(t: T) { f((a, b, ...x) => {}); } +declare function f5(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(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];