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
I am using instanceof in a piece of code to execute different operations based on the type of a variable. The code can be compiled successfully after commenting out the unimplemented function call. However, if I use unimplemented to throw an exception, the type information is missing . In this case, the compiler throws TS2339.
Bug Report
π Search Terms
throw Error
,never
,instanceof
,TS2339
,Unreachable
π Version & Regression Information
TypeScript Version 5.0.2
β― Playground Link
Playground link with relevant code
π» Code
I am using
instanceof
in a piece of code to execute different operations based on the type of a variable. The code can be compiled successfully after commenting out theunimplemented
function call. However, if I useunimplemented
to throw an exception, the type information is missing . In this case, the compiler throws TS2339.π Actual behavior
Property 'val' does not exist on type 'IValue'.
is reported.π Expected behavior
The code can be compiled successfully even if there is unreachable code, and the type check of
instanceof
should not be ignored.The text was updated successfully, but these errors were encountered: