mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-09 16:39:46 -05:00
Add regression test
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
tests/cases/compiler/switchCaseCircularRefeference.ts(5,10): error TS2678: Type '{ a: "A"; b: any; } | { a: "C"; e: any; }' is not comparable to type '"A" | "C"'.
|
||||
Type '{ a: "C"; e: any; }' is not comparable to type '"A" | "C"'.
|
||||
Type '{ a: "C"; e: any; }' is not comparable to type '"C"'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/switchCaseCircularRefeference.ts (1 errors) ====
|
||||
// Repro from #9507
|
||||
|
||||
function f(x: {a: "A", b} | {a: "C", e}) {
|
||||
switch (x.a) {
|
||||
case x:
|
||||
~
|
||||
!!! error TS2678: Type '{ a: "A"; b: any; } | { a: "C"; e: any; }' is not comparable to type '"A" | "C"'.
|
||||
!!! error TS2678: Type '{ a: "C"; e: any; }' is not comparable to type '"A" | "C"'.
|
||||
!!! error TS2678: Type '{ a: "C"; e: any; }' is not comparable to type '"C"'.
|
||||
break;
|
||||
}
|
||||
}
|
||||
18
tests/baselines/reference/switchCaseCircularRefeference.js
Normal file
18
tests/baselines/reference/switchCaseCircularRefeference.js
Normal file
@@ -0,0 +1,18 @@
|
||||
//// [switchCaseCircularRefeference.ts]
|
||||
// Repro from #9507
|
||||
|
||||
function f(x: {a: "A", b} | {a: "C", e}) {
|
||||
switch (x.a) {
|
||||
case x:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//// [switchCaseCircularRefeference.js]
|
||||
// Repro from #9507
|
||||
function f(x) {
|
||||
switch (x.a) {
|
||||
case x:
|
||||
break;
|
||||
}
|
||||
}
|
||||
8
tests/cases/compiler/switchCaseCircularRefeference.ts
Normal file
8
tests/cases/compiler/switchCaseCircularRefeference.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// Repro from #9507
|
||||
|
||||
function f(x: {a: "A", b} | {a: "C", e}) {
|
||||
switch (x.a) {
|
||||
case x:
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user