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
Assigning an interface with additional properties to an interface with fewer properties fails. While this is common in some programming languages, this also goes against the duck typing principle that as long as all properties of an interface are present it is compatible, even if additional unrelated properties are present.
Expected Behavior
The assignment should work without error.
Steps To Reproduce
Define one interface X with one property x: num
Define one interface Y with the properties x: num and y: num (Y "extends" X and is compatible with it)
Assign a value that is typed as Y to a variable with type X.
Is there an existing issue for this?
I am following the documentation's guide
This issue exists in the latest version
Current Behavior
Assigning an interface with additional properties to an interface with fewer properties fails. While this is common in some programming languages, this also goes against the duck typing principle that as long as all properties of an interface are present it is compatible, even if additional unrelated properties are present.
Expected Behavior
The assignment should work without error.
Steps To Reproduce
X
with one propertyx: num
Y
with the propertiesx: num
andy: num
(Y "extends" X and is compatible with it)Y
to a variable with typeX
.Example:
Environment
The text was updated successfully, but these errors were encountered: