From 38d1f7f0d22e5d706af3e18146fb2fcb4333b4c6 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Fri, 27 Apr 2018 16:50:09 -0700 Subject: [PATCH] Add tests --- .../types/intersection/intersectionReduction.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/cases/conformance/types/intersection/intersectionReduction.ts diff --git a/tests/cases/conformance/types/intersection/intersectionReduction.ts b/tests/cases/conformance/types/intersection/intersectionReduction.ts new file mode 100644 index 00000000000..b3b8950c330 --- /dev/null +++ b/tests/cases/conformance/types/intersection/intersectionReduction.ts @@ -0,0 +1,15 @@ +// @strict + +declare const sym1: unique symbol; +declare const sym2: unique symbol; + +type T1 = string & 'a'; // 'a' +type T2 = 'a' & string & 'b'; // 'a' & 'b' +type T3 = number & 10; // 10 +type T4 = 10 & number & 20; // 10 & 20 +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 T10 = string & ('a' | 'b'); // 'a' | 'b' +type T11 = (string | number) & ('a' | 10); // 'a' | 10