mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
23 lines
523 B
TypeScript
23 lines
523 B
TypeScript
function f(x: string | number | boolean) {
|
|
let y: string | number | boolean = false;
|
|
let z: string | number | boolean = false;
|
|
if (y = "", typeof x === "string") {
|
|
x; // string
|
|
y; // string
|
|
z; // boolean
|
|
}
|
|
else if (z = 1, typeof x === "number") {
|
|
x; // number
|
|
y; // string
|
|
z; // number
|
|
}
|
|
else {
|
|
x; // boolean
|
|
y; // string
|
|
z; // number
|
|
}
|
|
x; // string | number | boolean
|
|
y; // string
|
|
z; // number | boolean
|
|
}
|