Skip to content
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

Merged
merged 2 commits into from
Sep 21, 2019
Merged

Add new type: ValuesType #99

merged 2 commits into from
Sep 21, 2019

Conversation

Axure
Copy link
Contributor

@Axure Axure commented Sep 8, 2019

Description

Add new type: ValuesType

Related issues:

Checklist

  • I have read CONTRIBUTING.md
  • I have linked all related issues above
  • I have rebased my branch

For new features:

  • I have added entry in TOC and API Docs
  • I have added a short example in API Docs to demonstrate new usage
  • I have added type unit tests with dts-jest

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

feat(utility-types): Add `ValuesType`.

Proposed in piotrwitek#75.
Copy link
Owner

@piotrwitek piotrwitek left a 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!

@@ -576,3 +576,41 @@ export type Optional<T extends object, K extends keyof T = keyof T> = Omit<
K
> &
Partial<Pick<T, K>>;

/**
* $ValuesType
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be ValuesType, without $

Copy link
Contributor Author

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 });
}

Copy link
Owner

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>`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice examples!

@@ -24,6 +24,25 @@ export type $Keys<T extends object> = keyof T;
*/
export type $Values<T extends object> = T[keyof T];

/**
Copy link
Owner

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@piotrwitek piotrwitek merged commit e2d2c6e into piotrwitek:master Sep 21, 2019
@piotrwitek
Copy link
Owner

@Axure great job, thx!

There is a IssueHunt bounty, please submit your PR: https://issuehunt.io/r/piotrwitek/utility-types/issues/75

@Axure
Copy link
Contributor Author

Axure commented Sep 21, 2019

@Axure great job, thx!

There is a IssueHunt bounty, please submit your PR: https://issuehunt.io/r/piotrwitek/utility-types/issues/75

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new type: ValuesType
2 participants