mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 02:29:04 +03:00
b887b30092
**Description:** This is required for https://github.com/swc-project/swc/pull/6981 and https://github.com/swc-project/swc/pull/6950
15 lines
218 B
TypeScript
15 lines
218 B
TypeScript
|
|
type S = "a" | "b";
|
|
type T = S[] | S;
|
|
|
|
function f(foo: T) {
|
|
if (foo === "a") {
|
|
return foo;
|
|
}
|
|
else if (foo === "b") {
|
|
return foo;
|
|
}
|
|
else {
|
|
return (foo as S[])[0];
|
|
}
|
|
} |