strictNullChecks
fails to prevent undefined assignments
#17236
Labels
Duplicate
An existing issue was already created
TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx)
This example currently compiles in the TypeScript playground with
strictNullChecks
enabled.Code
With
strictNullChecks
enabled:Expected behavior:
I expect a compilation error.
Widget
'sprice
field is not nullable, but every constructed widget will have anundefined
price.The constructor should ensure
price
is non-null.Actual behavior:
The code compiles. Two non-nullable
number
s are set toundefined
:somePrice
andwidget.price
.P.S. I'm in love with TypeScript. Thank you for your amazing work!
The text was updated successfully, but these errors were encountered: