You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior:
Everything works without errors, maybeNumber preserves type of number | undefined and refines to number in the if block.
letmaybeNumber: number|undefined;// Control flow figured that: maybeNumber === undefined(function(){maybeNumber=1;})();// --> oops, unknown side effects// Revert maybeNumber to initial `number | undefined` to cover all possibilitiesif(maybeNumber){// Control flow: can refine to `number` again heremaybeNumber++;}
Actual behavior:
Language service reports type nothing on maybeNumber after the call (even though it's number | undefined before the call), so statement inside of the if condition breaks.
The text was updated successfully, but these errors were encountered:
TypeScript Version:
nightly (1.9.0-dev.20160429)
Code
Expected behavior:
Everything works without errors,
maybeNumber
preserves type ofnumber | undefined
and refines tonumber
in theif
block.Actual behavior:
Language service reports type
nothing
onmaybeNumber
after the call (even though it'snumber | undefined
before the call), so statement inside of theif
condition breaks.The text was updated successfully, but these errors were encountered: