1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements03.ts(10,10): error TS2678: Type '"bar" | "baz"' is not comparable to type '"foo"'.
Type '"baz"' is not comparable to type '"foo"'.
tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements03.ts(12,10): error TS2678: Type '"bar"' is not comparable to type '"foo"'.
tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements03.ts(14,10): error TS2678: Type '"baz"' is not comparable to type '"foo"'.
tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements03.ts(14,11): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements03.ts(14,11): error TS2695: Left side of comma operator is unused and has no side effects.
tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements03.ts(20,10): error TS2678: Type '"bar" | "baz"' is not comparable to type '"foo"'.
Type '"baz"' is not comparable to type '"foo"'.
tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements03.ts(22,10): error TS2678: Type '"bar" | "baz"' is not comparable to type '"foo"'.
Type '"baz"' is not comparable to type '"foo"'.
tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements03.ts(23,10): error TS2678: Type '"bar" | "baz"' is not comparable to type '"foo"'.
Type '"baz"' is not comparable to type '"foo"'.
==== tests/cases/conformance/types/literal/stringLiteralsWithSwitchStatements03.ts (8 errors) ====
let x: "foo";
let y: "foo" | "bar";
let z: "bar";
declare function randBool(): boolean;
switch (x) {
case randBool() ? "foo" : "baz":
break;
case (randBool() ? ("bar") : "baz" ? "bar" : "baz"):
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2678: Type '"bar" | "baz"' is not comparable to type '"foo"'.
!!! error TS2678: Type '"baz"' is not comparable to type '"foo"'.
break;
case (("bar")):
~~~~~~~~~
!!! error TS2678: Type '"bar"' is not comparable to type '"foo"'.
break;
case (x, y, ("baz")):
~~~~~~~~~~~~~~~
!!! error TS2678: Type '"baz"' is not comparable to type '"foo"'.
~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
~~~~
!!! error TS2695: Left side of comma operator is unused and has no side effects.
x;
y;
break;
case (("foo" || ("bar"))):
break;
case (("bar" || ("baz"))):
~~~~~~~~~~~~~~~~~~~~
!!! error TS2678: Type '"bar" | "baz"' is not comparable to type '"foo"'.
!!! error TS2678: Type '"baz"' is not comparable to type '"foo"'.
break;
case z || "baz":
~~~~~~~~~~
!!! error TS2678: Type '"bar" | "baz"' is not comparable to type '"foo"'.
!!! error TS2678: Type '"baz"' is not comparable to type '"foo"'.
case "baz" || z:
~~~~~~~~~~
!!! error TS2678: Type '"bar" | "baz"' is not comparable to type '"foo"'.
!!! error TS2678: Type '"baz"' is not comparable to type '"foo"'.
z;
break;
}
|