Comments (8)
Well-well-well...
You're assigning a number to the property having schema z.coerce.string()
.
Typescript validates the handler's returns using z.input< typeof z.coerce.string() >
, and it seems to be just string
, so you're getting an error.
I'd say, that this is more likely the zod
's issue of the way the schemas with coercion being inferred.
But I'll check it more precisely tomorrow.
Thank you for letting me know, @teaishealthy
from express-zod-api.
I think it's not about
bigint
, it's about yourname
property, which isstring
, but you're assigning a number to it,
I don't think my provided example was directly related to the schema issue, I just found it while tinkering around. I can try to provide an example later this day.
from express-zod-api.
I don't think my provided example was directly related to the schema issue, I just found it while tinkering around. I can try to provide an example later this day.
I checked the example in details — it's fine and it really reveals the confusion with the new coercion feature in Zod.
The problem is that coerce
feature is not reflected on the type level, it only works in runtime.
I posted a more generic issue in Zod repo with a question to Colin. Maybe they would explain should it be fixed or it's somehow intentional.
Anyway, thank you @teaishealthy
from express-zod-api.
The issue confirmed as a bug of zod
, @teaishealthy
colinhacks/zod#1760 (comment)
from express-zod-api.
I made a PR that should fix the issue in zod, but I'm still waiting for its approval.
colinhacks/zod#1793
from express-zod-api.
Bad news, @teaishealthy .
The author of zod
confirmed the bug, but does not want to fix it (now), since according to the author's vision it requires a complete refactoring of zod
to be less messy.
¯\_(ツ)_/¯
Not sure yet what I can do about it...
from express-zod-api.
That's really unfortunate 😕 although I should be able to get along without .coere
for the time being
Anyway thank you for your efforts on this issue 👍
from express-zod-api.
Regarding z.coerce.bigint()
— this is also third party bug:
colinhacks/zod#1911
from express-zod-api.
Related Issues (20)
- allow to add annotations for routes for generated client HOT 1
- responseProps HOT 3
- ez.upload() does not work for attached express aplications. HOT 1
- `ez.upload()` does not work with `.attachRouting()` HOT 4
- Type error: `BearerSecurity` cannot be named HOT 4
- Make `winston` a peer
- Problem to create routings HOT 5
- Can't use .z.ZodArray as output schema HOT 6
- Task: Restore SWC for `ts-node` when new version released
- Specifying input headers HOT 8
- TypeScript errors TS4023, TS4094 HOT 11
- Multiple servers in Swagger HOT 2
- Export request/response types from generated client HOT 5
- Listening to a configurable hostname HOT 1
- Insufficient types export (TS4023) of `Metadata` HOT 1
- Task: fix NPM warning during publishing
- Cannot create multiple errors response when generate Document
- Set schema name using withMeta
- Type regression from 16.1.0 to 16.2.0 HOT 3
- incorrect pattern field for openapi HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-zod-api.