Open felixmosh opened 1 year ago
Hi,
Thanks for all those PRs, I'm a bit torn on this one though. isStrict
has been so far used by many people to ensure the schema contains what the type mandates, while inference is a goal, the other way around is also kind of nice, do you think it would be possible to preserve this?
This is how zod does that... It is weird (in my opinion) the need of writing a type manually, and then repeat it within the object it self....
I guess i can add an overload or something.
Is it going to be updated/pushed?
This PR improves object's types.
Before
regular object - output schema is
any
with
keys
- output schema isany
with
append
- output schema not changedwith
rename
- no key completion, output schema not changedwith
with
- no key's completionwith
without
- no key's completionAfter
regular object usage incorporates the object type that was passed which means that calling to
attempt
returns the object type properlyusing
keys
without provided object extending provided objectwith
append
append
with null or undefined not changing the original obj appending new object keyswith
rename
- key completion, output schema changedwith
with
- key completion completes the rest of the keys (since.with('foo', 'foo')
doesn't make sense)with
without
- same aswith
closes #2978