-
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
Fixed types of properties of contextual filtering mapped types #56201
Fixed types of properties of contextual filtering mapped types #56201
Conversation
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
@typescript-bot test this |
Heya @RyanCavanaugh, I've started to run the tarball bundle task on this PR at 546f5d7. You can monitor the build here. |
Heya @RyanCavanaugh, I've started to run the parallelized Definitely Typed test suite on this PR at 546f5d7. You can monitor the build here. Update: The results are in! |
Heya @RyanCavanaugh, I've started to run the diff-based user code test suite (tsserver) on this PR at 546f5d7. You can monitor the build here. Update: The results are in! |
Heya @RyanCavanaugh, I've started to run the diff-based top-repos suite on this PR at 546f5d7. You can monitor the build here. Update: The results are in! |
Heya @RyanCavanaugh, I've started to run the diff-based top-repos suite (tsserver) on this PR at 546f5d7. You can monitor the build here. Update: The results are in! |
Heya @RyanCavanaugh, I've started to run the regular perf test suite on this PR at 546f5d7. You can monitor the build here. Update: The results are in! |
Heya @RyanCavanaugh, I've started to run the diff-based user code test suite on this PR at 546f5d7. You can monitor the build here. Update: The results are in! |
Hey @RyanCavanaugh, 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 |
@RyanCavanaugh Here are the results of running the user test suite comparing Everything looks good! |
@RyanCavanaugh Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
@RyanCavanaugh Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
Hey @RyanCavanaugh, the results of running the DT tests are ready. |
@RyanCavanaugh Here are the results of running the top-repos suite comparing Everything looks good! |
1 similar comment
@RyanCavanaugh Here are the results of running the top-repos suite comparing Everything looks good! |
|
||
declare function f2<T extends object>( | ||
data: T, | ||
handlers: { [P in keyof T as T[P] extends string ? P : never]: (value: T[P], prop: P) => void }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Is there any reason you're using the extends string
here instead of extends PropertyKey
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's meant to actually filter something, so I intentionally filter T[P]
that match some subset of potential types. Note that I'm checking against T[P]
and not just P
- but even if the check would be against P
, I could still want to filter the keys so PropertyKey
isn't what I'd use here
…ontextual-filtering-mapped-type
This also makes me wonder if this is also a bug: - const keysRemapped = !!target.declaration.nameType;
+ const keysRemapped = getMappedTypeNameTypeKind(target) === MappedTypeNameTypeKind.Remapping; (Or maybe other places where |
This is based on the contextualPropertyOfGenericMappedType test case - just with the added filtering
.nameType
fixes #56881