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

Feature request: New type Required<T, K> to complement Optional<T, K> #93

Closed
vhenzl opened this issue Jul 5, 2019 · 1 comment · Fixed by #101
Closed

Feature request: New type Required<T, K> to complement Optional<T, K> #93

vhenzl opened this issue Jul 5, 2019 · 1 comment · Fixed by #101

Comments

@vhenzl
Copy link

vhenzl commented Jul 5, 2019

Created as per #82 (comment)

Implementation should be straightforward:

type SomeRequired<T extends object, K extends keyof T = keyof T> = Omit<T, K> & Required<Pick<T, K>>;

Not sure about naming. Can't be Required as it conflicts with the built-in type. Any better idea than SomeRequired?

@piotrwitek
Copy link
Owner

Required is fine, as it's a superset and is compatible with native Required so
Local imports will not break any of the global references.

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

Successfully merging a pull request may close this issue.

2 participants