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

Proposal: RequiredDeep #273

Closed
osdiab opened this issue Sep 27, 2021 · 5 comments · Fixed by #614
Closed

Proposal: RequiredDeep #273

osdiab opened this issue Sep 27, 2021 · 5 comments · Fixed by #614
Labels
help wanted Extra attention is needed type addition

Comments

@osdiab
Copy link

osdiab commented Sep 27, 2021

similar to PartialDeep but the inverse, where all KV pairs are required.

@sindresorhus
Copy link
Owner

What's the use-case?

@osdiab
Copy link
Author

osdiab commented Sep 28, 2021

In my application I have the concept of an "in progress" form which is stored in one DB table, and then the "completed and finalized" form data which is stored in another DB table. The schemas are expressed as Zod schemas and saved in the database as JSON blobs (since the schema is still in flux and we wanted flexibility).

Some data is nested, some are optional in that in-progress form and some are not, but the thing that's definitely true is that all leaves need to be there in the finalized version of the form data. So it's more ergonomic for me to express that type as a deeply required version of the in-progress form.

There are other ways around it but yeah figured that I'm not the only person who might have some usecase for this kind of type.

@sindresorhus sindresorhus changed the title Proposal: RequiredDeep Proposal: RequiredDeep Oct 1, 2021
@sindresorhus
Copy link
Owner

Makes sense. Accepted.

@sindresorhus sindresorhus added help wanted Extra attention is needed type addition labels Oct 1, 2021
Repository owner deleted a comment from andersonba Nov 4, 2022
@sindresorhus
Copy link
Owner

If anyone wants to work on this, see the initial attempt and feedback: #401

@moltar
Copy link

moltar commented Mar 31, 2023

https://github.com/ts-essentials/ts-essentials/tree/master/lib/deep-required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type addition
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants