-
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
Add KeyOf
and ValueOf
definitions to built-in lib
#31438
Comments
Here's implementation declare type KeyOf<T> = T extends any ? keyof T : never;
declare type ValueOf<T> = T extends any ? T[ keyof T ] : never; |
KeyOf
and ValueOf
definitions to built-in lib
I use $Values by "utility-types" quite often, and find it useful. Would be nice to see a build-in Typescript version. |
A quick search on GitHub shows a mountain of projects defining their own ValueOf or importing type-fest's ValueOf.
|
This is something that would likely be quite welcomed by the TypeScript community. |
New utility types are declined by policy. See https://github.com/microsoft/TypeScript/wiki/FAQ#new-utility-types |
Search Terms
None -
Empirical experience -
Suggestion
I want to see added
KeyOf
andValueOf
Use Cases
Let them distribute union
Examples
instead of
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: