-
-
Notifications
You must be signed in to change notification settings - Fork 230
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 new type: ValuesType
#99
Conversation
feat(utility-types): Add `ValuesType`. Proposed in piotrwitek#75.
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.
Hey @Axure,
Thanks for PR, ValuesType
in mapped-types looks good, but could you please remove $ValuesType
from utility-types, it was not requested to be added and shouldn't be there. Thanks!
src/mapped-types.ts
Outdated
@@ -576,3 +576,41 @@ export type Optional<T extends object, K extends keyof T = keyof T> = Omit< | |||
K | |||
> & | |||
Partial<Pick<T, K>>; | |||
|
|||
/** | |||
* $ValuesType |
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.
Should be ValuesType, without $
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.
Oops I forgot to change the examples when I copied it from the $ValuesType
I wrote at first.
I've removed that $
.
@@ -501,3 +502,28 @@ type RequiredOptionalProps = { | |||
// @dts-jest:pass:snap -> Optional<Props, "age" | "visible"> | |||
testType<Optional<Props, 'age' | 'visible'>>({ name: 'Yolo', age: 99 }); | |||
} | |||
|
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.
tests looking good! 👍
@@ -586,6 +587,34 @@ type ExtendedProps = Assign<Props, NewProps>; | |||
|
|||
[⇧ back to top](#table-of-contents) | |||
|
|||
### `ValuesType<T>` |
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.
nice examples!
src/utility-types.ts
Outdated
@@ -24,6 +24,25 @@ export type $Keys<T extends object> = keyof T; | |||
*/ | |||
export type $Values<T extends object> = T[keyof T]; | |||
|
|||
/** |
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.
All related $ValuesType code and tests should be removed
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.
Done.
@Axure great job, thx! There is a IssueHunt bounty, please submit your PR: https://issuehunt.io/r/piotrwitek/utility-types/issues/75 |
Done. |
Description
Add new type:
ValuesType
Related issues:
Checklist
For new features:
dts-jest
IssueHunt Summary
Referenced issues
This pull request has been submitted to:
IssueHunt has been backed by the following sponsors. Become a sponsor