-
Notifications
You must be signed in to change notification settings - Fork 12.8k
variance of subtyping #33234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
A not-so-great workaround at the moment is to just make all your properties I personally do that but it's unnerving that I can slip up and make a mistake, and not have the compiler tell me about it |
I don't think we're likely to make Intersection behaves better, so I'd recommend that over |
Doesn't TS add new breaking behavior behind a flag? Anything that relies on unsound extends can turn it off, and everyone else that wants more safety, and are masochistic can use the new flag |
I'm curious if anyone's run into issues in real code arising from this issue. |
TypeScript Version: 3.6
Search Terms:
subtyping invariant covariant
Code
Expected behavior:
Can't extends when property foo of b isn't readonly
Actual behavior:
It has no warning and no error
Playground Link:
Related Issues:
The text was updated successfully, but these errors were encountered: