Closed
Description
TypeScript Version: 2.0.2
Code
function isNumber(test: number|string): test is number {
return typeof test === "number";
}
function blah(arg: () => void): void { }
let x: any = 4;
if(isNumber(x)) {
x; // x is correctly narrowed to number here
blah(() => {
x; // typeof x is any again
})
}
Expected behavior:
(I think) x
should still be inferred as type number in the inner function.
Actual behavior:
x
is inferred as any