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
TypeScript Version: TSLint 2.4.0 in VSCode and www.typescriplang.org playground today (2017-08-16)
Code
leta: {property?: string}=1234;// why is this allowed?
Expected behavior:
It should not be possible to assign a number to a variable a of type { property?: string } or ... { property?: string | undefined; } if strict-null-check is turned on.
Actual behavior: a is assigned the value 1234
If the type's property is not optional, it behaves as expected, i.e. type { property: string }.
The text was updated successfully, but these errors were encountered:
TypeScript Version: TSLint 2.4.0 in VSCode and
www.typescriplang.org
playground today (2017-08-16)Code
Expected behavior:
It should not be possible to assign a number to a variable
a
of type{ property?: string }
or... { property?: string | undefined; }
if strict-null-check is turned on.Actual behavior:
a
is assigned the value 1234If the type's property is not optional, it behaves as expected, i.e. type
{ property: string }
.The text was updated successfully, but these errors were encountered: