mirror of
https://github.com/swc-project/swc.git
synced 2024-12-18 19:21:33 +03:00
38 lines
753 B
TypeScript
38 lines
753 B
TypeScript
declare function getStringOrNumber(): string | number;
|
|
|
|
function f1() {
|
|
const x = getStringOrNumber();
|
|
if (typeof x === "string") {
|
|
const f = () => x.length;
|
|
}
|
|
}
|
|
|
|
function f2() {
|
|
const x = getStringOrNumber();
|
|
if (typeof x !== "string") {
|
|
return;
|
|
}
|
|
const f = () => x.length;
|
|
}
|
|
|
|
function f3() {
|
|
const x = getStringOrNumber();
|
|
if (typeof x === "string") {
|
|
const f = function() { return x.length; };
|
|
}
|
|
}
|
|
|
|
function f4() {
|
|
const x = getStringOrNumber();
|
|
if (typeof x !== "string") {
|
|
return;
|
|
}
|
|
const f = function() { return x.length; };
|
|
}
|
|
|
|
function f5() {
|
|
const x = getStringOrNumber();
|
|
if (typeof x === "string") {
|
|
const f = () => () => x.length;
|
|
}
|
|
} |