-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
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
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code