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
functionthrowErrorFunction() : never{thrownewError("Error in function")}classErrorService{throwErrorClass(): never{thrownewError("Error in class")}}functionneverNotWorkingAsExpected(){consterrorService=newErrorService();errorService.throwErrorClass();// The following line should be detected as unreachablethrowErrorFunction();}functionneverWorkingAsExpected(){throwErrorFunction();// The following code is detected as unreachableconsterrorService=newErrorService();errorService.throwErrorClass();}
π Actual behavior
Code following a function of a class of type 'never' is not considered inaccessible.
It does not have the same behavior as a function that is not in a class.
π Expected behavior
The never type is correctly handled when used in a function of a class.
So after using the function, the following code is considered unreachable.
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
π Version & Regression Information
never
type and classβ― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
Code following a function of a class of type 'never' is not considered inaccessible.
It does not have the same behavior as a function that is not in a class.
π Expected behavior
The
never
type is correctly handled when used in a function of a class.So after using the function, the following code is considered unreachable.
The text was updated successfully, but these errors were encountered: