From c58157573e863e4a9838cbd7a62874e06e8f7b2b Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 1 Feb 2019 10:48:52 -0800 Subject: [PATCH] Add breaking change repros --- .../compiler/inferFromGenericFunctionReturnTypes3.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts b/tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts index e44e7c4a5e0..429d98b6a39 100644 --- a/tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts +++ b/tests/cases/compiler/inferFromGenericFunctionReturnTypes3.ts @@ -172,3 +172,13 @@ const f1: F = () => { } ]); }; + +// Breaking change repros from #29478 + +declare function foldLeft(z: U, f: (acc: U, t: boolean) => U): U; +let res: boolean = foldLeft(true, (acc, t) => acc && t); // Error + +enum State { A, B } +type Foo = { state: State } +declare function bar(f: () => T[]): T[]; +let x: Foo[] = bar(() => !!true ? [{ state: State.A }] : [{ state: State.B }]); // Error