From 89a8b5094ac9be0e412902d414779916ee3b45dd Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Thu, 9 Aug 2018 16:33:54 -0400 Subject: [PATCH] Add test --- tests/cases/compiler/indexingTypesWithNever.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/cases/compiler/indexingTypesWithNever.ts b/tests/cases/compiler/indexingTypesWithNever.ts index 9044ded2ff..b81bf533eb 100644 --- a/tests/cases/compiler/indexingTypesWithNever.ts +++ b/tests/cases/compiler/indexingTypesWithNever.ts @@ -109,3 +109,11 @@ declare const o3Test: ExpectType<{ a?: string; b?: number }, O3Props>; declare const o2Test: ExpectType<{ a?: string }, O2Props>; declare const o1Test: ExpectType<{}, O1Props>; declare const o0Test: ExpectType<{}, O0Props>; + +// Repro from #23005 + +type Example> = T['a']; + +type Res1 = Example<{ a: "x" } | { a: "y" }>; // "x" | "y" +type Res2 = Example<{ a: "x" }>; // "x" +type Res3 = Example; // never