Contravariant inference gets picked when a a better covariant candidate exists #57908
Labels
Help Wanted
You can do this
Possible Improvement
The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Milestone
π Search Terms
covariant covariance contravariant contravariance inference candidates subtyping assignable subtype
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.5.0-dev.20240322#code/C4TwDgpgBAShCOBXCBnYAeAKgZQMYAsIBbAQyggA9gIA7AExSj0NID4oBeKAbwCgooSCACcQALig4CxEgG0ARENHyAugG5eAXw29QkJtNKceg5KID8ExDQDWNAPYB3GmqgAje3RCWo1u05oobV5eOghcABsSYWgAM2tcYABLe0Dhe0RqLGYZcipaBgMWElYACns3ACsJPgEwGIlSkgkpYoBKTnYAN3skug0BFENmyRzSAah8EnoIiEaY+Ak4ITRs4dYOjm7e-q02iR6+nVxUtCgukgi+kmpjUoB9GtMRbytbB2dXDy8fPw-AzSbdjcYK8dKZCClWpQepzc6Xa7UAA0-CgQ2KNVRAiU4ig8nkKIEmkJk2mdFm8wQQJ4WKgJxoZ2oaAkaGESRoAHNjAsAHQ4ibEvY6ShgezCYA8YJAA
π» Code
π Actual behavior
assignment to
test
fails because{ query?: unknown; body?: unknown; }
was inferred thereπ Expected behavior
I'd expect
{ query: string }
to be inferred here and the assignment totest
to succeedAdditional information about the issue
This is a reduced version of this failure.
The text was updated successfully, but these errors were encountered: