We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When creating schemas I don't always want to set initial values.
Let's say we want to describe this type in a schema:
type ComponentMap = Record<string, { id: string; name: string; }>;
How the current schema builder works is that you have to pass in default values like so:
s.obj({ key: s.obj({ id: s.con(""), name: s.con("")> }) })
There are a couple of problems with this:
{ key: { id: "", name: "" } }
key
Record<string, ...>
Ideas:
noDefaultValues
s.record()
Examples:
s.record( s.con<string>(), s.obj({ id: s.con<string>(), name: s.con<string>() }) )
The text was updated successfully, but these errors were encountered:
I found out that there is a .map builder which solves issue 2. but issue 1. still remains
.map
Sorry, something went wrong.
No branches or pull requests
When creating schemas I don't always want to set initial values.
Let's say we want to describe this type in a schema:
How the current schema builder works is that you have to pass in default values like so:
There are a couple of problems with this:
{ key: { id: "", name: "" } }
that we have to overridekey
key but in this case I just want to have aRecord<string, ...>
Ideas:
noDefaultValues
s.record()
schema type like zod doesExamples:
The text was updated successfully, but these errors were encountered: