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 OptionalKeysOf, HasOptionalKeys, RequiredKeysOf, HasRequiredKeys types #405

Merged

Conversation

Menecats
Copy link
Contributor

This PR adds four new types:

  • OptionalKeysOf: Extracts all the optional keys of the given object type
  • HasOptionalKeys: Returns true / false depending on the presence/absence of optional fields of the given object type
  • RequiredKeysOf: Extracts all the required keys of the given object type
  • HasRequiredKeys: Returns true / false depending on the presence/absence of required fields of the given object type

@sindresorhus
Copy link
Owner

I would prefer each type to have its own file. Same with tests.

source/optional-keys.d.ts Outdated Show resolved Hide resolved
source/optional-keys.d.ts Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
@sindresorhus sindresorhus merged commit f0b1c3f into sindresorhus:main Jul 3, 2022
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.

None yet

2 participants