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
So, when comparing the types on either sides of the declaration (or assignment, or return, or call):
Both sides readonly (safe because neither can be mutated)
Right hand side is an object literal (safe because no reference can be retained to the right hand side) - TODO but what if the object literal sets a property to a value that we do retain a reference to
Both sides mutable AND neither side is a type union AND both sides are exactly the same type (safe because mutating one can't break the type of the other)
TODO: work out how to handle unions
TODO: work out how to handle subtype relationship (argument is a subtype of param)
danielnixon
changed the title
New rule: invariant mutable properties
New rule: unsafe assignment
Jun 14, 2020
danielnixon
changed the title
New rule: unsafe assignment
New rule: unsafe assignment / declaration
Jun 14, 2020
Prevent this:
And this:
see microsoft/TypeScript#14150 and microsoft/TypeScript#13347
The text was updated successfully, but these errors were encountered: