From 9cc9fb9bd761cd19b363fe232b8a1d0ef1ed1feb Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sun, 9 Jun 2019 08:00:01 -0700 Subject: [PATCH] Update tests --- tests/cases/conformance/types/conditional/inferTypes1.ts | 2 +- .../types/intersection/intersectionReduction.ts | 8 ++++---- .../types/intersection/intersectionTypeInference2.ts | 4 ++-- .../types/keyof/keyofAndIndexedAccessErrors.ts | 2 +- .../typeInference/unionAndIntersectionInference2.ts | 4 ++-- tests/cases/conformance/types/unknown/unknownType1.ts | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/cases/conformance/types/conditional/inferTypes1.ts b/tests/cases/conformance/types/conditional/inferTypes1.ts index 83d6bd0c0b3..3be629b86ba 100644 --- a/tests/cases/conformance/types/conditional/inferTypes1.ts +++ b/tests/cases/conformance/types/conditional/inferTypes1.ts @@ -71,7 +71,7 @@ type X3 = T extends { a: (x: infer U) => void, b: (x: infer U) => void } ? U type T50 = X3<{}>; // never type T51 = X3<{ a: (x: string) => void }>; // never type T52 = X3<{ a: (x: string) => void, b: (x: string) => void }>; // string -type T53 = X3<{ a: (x: number) => void, b: (x: string) => void }>; // string & number +type T53 = X3<{ a: (x: number) => void, b: (x: string) => void }>; // never type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number type T60 = infer U; // Error diff --git a/tests/cases/conformance/types/intersection/intersectionReduction.ts b/tests/cases/conformance/types/intersection/intersectionReduction.ts index b3b8950c330..a6d2bf556b3 100644 --- a/tests/cases/conformance/types/intersection/intersectionReduction.ts +++ b/tests/cases/conformance/types/intersection/intersectionReduction.ts @@ -4,12 +4,12 @@ declare const sym1: unique symbol; declare const sym2: unique symbol; type T1 = string & 'a'; // 'a' -type T2 = 'a' & string & 'b'; // 'a' & 'b' +type T2 = 'a' & string & 'b'; // never type T3 = number & 10; // 10 -type T4 = 10 & number & 20; // 10 & 20 +type T4 = 10 & number & 20; // never type T5 = symbol & typeof sym1; // typeof sym1 -type T6 = typeof sym1 & symbol & typeof sym2; // typeof sym1 & typeof sym2 -type T7 = string & 'a' & number & 10 & symbol & typeof sym1; // 'a' & 10 & typeof sym1 +type T6 = typeof sym1 & symbol & typeof sym2; // never +type T7 = string & 'a' & number & 10 & symbol & typeof sym1; // never type T10 = string & ('a' | 'b'); // 'a' | 'b' type T11 = (string | number) & ('a' | 10); // 'a' | 10 diff --git a/tests/cases/conformance/types/intersection/intersectionTypeInference2.ts b/tests/cases/conformance/types/intersection/intersectionTypeInference2.ts index d32441cfee8..d4ed0d9f970 100644 --- a/tests/cases/conformance/types/intersection/intersectionTypeInference2.ts +++ b/tests/cases/conformance/types/intersection/intersectionTypeInference2.ts @@ -3,8 +3,8 @@ declare function f(x: { prop: T }): T; declare const a: { prop: string } & { prop: number }; declare const b: { prop: string & number }; -f(a); // string & number -f(b); // string & number +f(a); // never +f(b); // never // Repro from #18354 diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts index d5fe7c24b5c..a8666841c85 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccessErrors.ts @@ -27,7 +27,7 @@ type T17 = Shape[void]; // Error type T18 = Shape[undefined]; // Error type T19 = Shape[{ x: string }]; // Error type T20 = Shape[string | number]; // Error -type T21 = Shape[string & number]; // Error +type T21 = Shape[string & number]; type T22 = Shape[string | boolean]; // Error type T30 = string[]["length"]; diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference2.ts b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference2.ts index 1b6a928ce02..274b46e3ad6 100644 --- a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference2.ts +++ b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference2.ts @@ -19,5 +19,5 @@ var c2: string & { name: string } & number; var d2: string & { name: string } & number & { name: string }; f2(a2); // string f2(b2); // string[] -f2(c2); // string & number -f2(d2); // string & number +f2(c2); // never +f2(d2); // never diff --git a/tests/cases/conformance/types/unknown/unknownType1.ts b/tests/cases/conformance/types/unknown/unknownType1.ts index 633b1407f96..f96d1bb32c6 100644 --- a/tests/cases/conformance/types/unknown/unknownType1.ts +++ b/tests/cases/conformance/types/unknown/unknownType1.ts @@ -4,7 +4,7 @@ type T00 = unknown & null; // null type T01 = unknown & undefined; // undefined -type T02 = unknown & null & undefined; // null & undefined (which becomes never in union) +type T02 = unknown & null & undefined; // never type T03 = unknown & string; // string type T04 = unknown & string[]; // string[] type T05 = unknown & unknown; // unknown