-
-
Notifications
You must be signed in to change notification settings - Fork 557
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
SetOptional
/SetRequired
/SetReadonly
: Fix instantiations with index signatures
#1014
SetOptional
/SetRequired
/SetReadonly
: Fix instantiations with index signatures
#1014
Conversation
6b2ba55
to
ab827f9
Compare
ab827f9
to
9d7471f
Compare
Note: The updated implementation of 1. Behaviour with primitives// Previous behaviour
type Test = Pick<string, 'toUpperCase'>;
// ^? type Test = { toUpperCase: () => string } // Updated behaviour
type Test = Pick<string, 'toUpperCase'>;
// ^? type Test = string And this happens because homomorphic mapped types pass through primitives unchanged. 2. Picking
|
I think it would be better to create an internal pick type for now. Do you think the new behavior is the correct one / better? If so, we could consider changing it in v5: #450 Alternatively, if both the old and new behavior makes sense in different situations, we could consider adding an option to the type. |
It’s hard to determine which behaviour is better, as these are very rare scenarios. While we could add an option for this, I doubt it'd be very useful—it might just create confusion. Currently, And IMO, the updated behaviour is better in the 1st case, while the previous behaviour is better in the 2nd, so this definitely needs more discussion. For now, I'll create an internal |
8fe5f99
to
19d58e3
Compare
@som-sm Nice work! You have done a lot of great work here lately. Would you be interested in being added as a maintainer? No worries if not :) |
@sindresorhus Yeah sure, I’d be happy to help as a maintainer and contribute further. |
Awesome 🎉 |
Fixes #1013
DistributedPick
so that it handlesany
properlySet-*
types now useDistributedPick
instead ofExcept
/Exclude
combination