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
declareconstx: unknown;()=>{if(xinstanceofError===false)return;x;// ^?// Should be 'Error', is 'unknown'}()=>{if(!(xinstanceofError))return;x;// ^?// Is correctly 'Error'}
🙁 Actual behavior
The semantically equivalent expressions (x instanceof Error === false) and !(x instanceof Error) influence type flow (correct term?) differently.
🙂 Expected behavior
(x instanceof Error === false) should function the same way !(x instanceof Error) does.
The text was updated successfully, but these errors were encountered:
Bug Report
🔎 Search Terms
instanceof explicit false if type narrowing
🕗 Version & Regression Information
5.1.0-dev.20230304
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
The semantically equivalent expressions
(x instanceof Error === false)
and!(x instanceof Error)
influence type flow (correct term?) differently.🙂 Expected behavior
(x instanceof Error === false)
should function the same way!(x instanceof Error)
does.The text was updated successfully, but these errors were encountered: