-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Type assertions #2
Comments
Just implemented type guards and published it to Tried to implement type assertions as well but it looks like it's not possible to do that yet without requiring duplicative typings :/ We'll have to wait and see on that. I'm splitting off the feature request for branded types into a different issue 👍 |
For future reference, the I'm closing this, since type assertions don't appear to work currently for generic classes such as ZodType. If this changes in the future I'll look into it again. And of course if someone cleverer than me figures out how to make assertions work, PRs are welcome! |
Whatever happened to I'm using 3.19.1 and can't seem to find anything in the docs.. |
https://www.npmjs.com/package/typed-assert mentions:
It doesn't seem that zod is able to perform TypeScript 3.7 assertions the way |
I've been thinking a lot about validation libaries and I share your frustration with Yup. Yup does not get everything right. I'm scared about to introducing io-ts is it has a high a cognitive overhead, but I really love what io-ts does.
I think I'll experiment with this libarary a bit, but in terms of io-ts features do you think zod could be improve with these features?
is()
method on codecs.assert()
) using the new assertion function types in typescript 3.7 (io-ts doesn't actually have this probably because it wants us to useEither
instead of exceptions)NonZeroNumber
orEmail
The text was updated successfully, but these errors were encountered: