mirror of
https://github.com/swc-project/swc.git
synced 2024-11-28 11:13:43 +03:00
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];
|
|
}
|
|
} |