-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Fresh object literal typed through satisfies
and mapped type lose the origin information
#52995
Comments
When the type of When it isn't, the only way to "see" that this call is OK is by brute enumeration of all possible inhabitants of So in this case, we have to trade a little bit of completeness for a big gain in performance. |
Cross-linking with #47109, which describes the working technique specifically as a way of dealing with the compiler's inability to efficiently scry into the multiverse of possible narrowings. |
Thanks jcalz, I can never find that one when I need to π |
Yeah, so I know about this limitation. This issue is specifically about the |
The eternal war between "TypeScript should always behave simply and consistently, even if it's a little bit worse" and "You can gerrymander in a little bit of logic to make things work when they otherwise wouldn't have" rages on. |
...so shut up and put on your poncho. You're in the splash zone. π |
This issue has been marked as 'Not a Defect' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Bug Report
π Search Terms
mapped type origin generic indexed access satisfies
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
It errors on the
action[move.type](move)
call within the generic function.π Expected behavior
It should be OK just like the variant with the declared type.
The text was updated successfully, but these errors were encountered: