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
functionisNumber(s: unknown): s is number{// it's the same even changed to string or other typesreturntypeofs==='number';}letc: unknown=123;if(!isNumber(c)){thrownewTypeError('what?');}c=c+1;/** * Why would an asserted number become unknown again? */if(c+1===0){console.log(c);}
🙁 Actual behavior
the assert number-typed variable c became unknown again.
🙂 Expected behavior
It should keep being number type
The text was updated successfully, but these errors were encountered:
Bug Report
A type-asserted variable from
unknown
, would becomeunknown
again at once its value changed🔎 Search Terms
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
the assert number-typed variable
c
becameunknown
again.🙂 Expected behavior
It should keep being
number
typeThe text was updated successfully, but these errors were encountered: