-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Cannot use type assertion to Partial<T>
where T is generic
#19470
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
@ahejlsberg we chatted about this issue earlier in the week. looking through the issues, there are multiple scenarios where this comes up, and our current behavior is not desired. |
I don't think it's the same issue, but it's definitely related. This is about making it easier to say "I know what I'm doing". |
@DanielRosenwasser Looking at this, the original example compiles with no errors with the current master (and, it appears, has since 2.5) because the comparable relation is more permissive that the assignable relation. @mhegazy The issues you reference above all have to do with assignability. Are you suggesting we change the rules there? If so, what would the new rules be? |
I originally wanted to discuss the all as a group, and we did. I have since closed all assignebilty issues as working as intended. |
In #19467, @GregorioBR filed an issue about assigning a
Foo
to aPartial<T>
whereT extends Foo
.However, in trying to solve the issue with a type assertion, I got an error:
This is surprising because I believe
Partial<S>
should be comparable to{ data: "test" }
.The text was updated successfully, but these errors were encountered: