mirror of
https://github.com/swc-project/swc.git
synced 2024-12-27 15:42:51 +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];
|
|
}
|
|
} |