mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 04:01:39 +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];
|
|
}
|
|
} |