-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Infer from filtering mapped types #52972
base: main
Are you sure you want to change the base?
Infer from filtering mapped types #52972
Conversation
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
Can you open a bug for that implied feature request? It makes it a lot easier for me to guess how much we want this feature. |
@sandersn I think that the referenced issue already does that. The reason why I didn't tag this PR as closing that issue is that the examples there are using renaming mapped types but I'm only fixing here filtering ones. The title of the issue is "Parameter type isn't inferred in values of mapped type with as." and this PR implements support for a subset of that. Why I didn't cover the other part of the story? There is no machinery in the compiler for reverse mapping the "computed" property name (the source property name) against the target's name type. However, there are already a couple of places that specifically handle those "filtering" mapped types (as they are way easier to handle). |
…apped-types # Conflicts: # src/compiler/checker.ts
379bc27
to
22fec49
Compare
@jakebailey could you create a playground for this one? :) |
f6f759b
to
fe90e8a
Compare
@typescript-bot pack this |
Heya @jakebailey, I've started to run the tarball bundle task on this PR at fe90e8a. You can monitor the build here. |
Hey @jakebailey, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
… to satisfy the constraint of the type param
@jakebailey could you build a fresh playground for this one? |
This implements a subset of the implied feature request from this issue: #46602