TypeScript Version: 2.0.0
Code
Expected behavior:
Accept this, and have the type inferencer postulate x:number[]. Alternatively, an error message along the lines of "cannot assign number to parameter {}" (because type inferencer could also assume x:undefined[]).
Actual behavior:
(with strictNullCheck)
error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
This might be because of how never is documented as the "bottom" type (for functions that never return), but since the code isn't using the result expression, this is pretty confusing. Is this because the assumed type of x is never[]?
I tried looking for related issues, I feel like it's slightly related to empty tuple discussions, but not 100% sure.
TypeScript Version: 2.0.0
Code
Expected behavior:
Accept this, and have the type inferencer postulate
x:number[]. Alternatively, an error message along the lines of "cannot assignnumberto parameter{}" (because type inferencer could also assumex:undefined[]).Actual behavior:
(with
strictNullCheck)error TS2345: Argument of type 'string' is not assignable to parameter of type 'never'.
This might be because of how
neveris documented as the "bottom" type (for functions that never return), but since the code isn't using the result expression, this is pretty confusing. Is this because the assumed type ofxisnever[]?I tried looking for related issues, I feel like it's slightly related to empty tuple discussions, but not 100% sure.