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
Expected behavior:
-Compiler complains that C doesn't implement properly B since it has no setter (and now we have a proper way to define an interface with a readonly property as A shows).
-Compiler complains if you try to pass a C to function baz.
In general with or without the "implements" declaration, C should not be assignable to B if it doesn't implement a setter for foo.
Actual behavior:
No Compile Errors.
Runtime error when baz tries to set the foo property.
I am not really sure this is a bug or some design choice, but I would definitely expect the type system to catch this, especially since we have the "readonly" keyword to mark properties that cannot be set.
The text was updated successfully, but these errors were encountered:
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
TypeScript Version: reproduced on 2.7.0-dev, and on 2.2.1
Code
Expected behavior:
-Compiler complains that C doesn't implement properly B since it has no setter (and now we have a proper way to define an interface with a readonly property as A shows).
-Compiler complains if you try to pass a C to function baz.
In general with or without the "implements" declaration, C should not be assignable to B if it doesn't implement a setter for foo.
Actual behavior:
No Compile Errors.
Runtime error when baz tries to set the foo property.
I am not really sure this is a bug or some design choice, but I would definitely expect the type system to catch this, especially since we have the "readonly" keyword to mark properties that cannot be set.
The text was updated successfully, but these errors were encountered: