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 Required<T, K> as the opposite of Optional<T, K> #101

Merged
merged 4 commits into from
Sep 24, 2019
Merged

Add new Required<T, K> as the opposite of Optional<T, K> #101

merged 4 commits into from
Sep 24, 2019

Conversation

spencersutton
Copy link
Contributor

@spencersutton spencersutton commented Sep 23, 2019

Description

Adds a new type Required<T, K> that makes keys K in type T required (default keyof T). Compatible with the built-in Required type.

Credit to @vhenzl for the basic implementation.

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

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 @spencersutton, thanks for the contribution, looking good.

One thing thought, I cannot see the internal module export at main index.ts file, did you missed that?

Let me know if something is not clear. Thanks

src/mapped-types.ts Outdated Show resolved Hide resolved
@spencersutton
Copy link
Contributor Author

I did miss adding it to index.ts. I've added that and incorporated your feedback. AugmentedRequired is now used everywhere and is renamed Required in the index.ts.

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.

That's awesome, thanks!

@piotrwitek piotrwitek merged commit 495fd1b into piotrwitek:master Sep 24, 2019
@piotrwitek
Copy link
Owner

I'll prepare a release tomorrow.

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.

Feature request: New type Required<T, K> to complement Optional<T, K>
2 participants