Use maketypes library for json-to-ts and json-to-zod transformations.#402
Use maketypes library for json-to-ts and json-to-zod transformations.#402EllAchE wants to merge 3 commits intoritz078:masterfrom
Conversation
Collapse unions in zod types
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Hey! Thanks for the pull request! I will message again when that time has come 😄 |
Thanks for the response and great to hear that this repo is active again! Assuming this is just a message you issued on all of the open pull requests here, but what in this PR would need to be modified to support Next? I'm also happy to help maintain, responded to this issue as well. #393 The feature I think would be useful & happy to help with to build would be enabling "to -> from" support. I.e. currently it's possible to do graphql -> typescript & typescript -> zod, but graphql -> zod is not supported. Letting the user chain the mappings we could enable support for graphql -> zod, admittedly at risk of more bugs. But it's at least something I would use to go json -> ts -> zod |
There are limitations to the currenty json-to-zod and json-to-ts libraries in use. I raised one specific issue in #401, but others include using any over union types, using null where undefined is appropriate etc.
Personally I think the maketypes library is a better default option and should just replace the current options, but being able to toggle between underlyings is also a viable approach here, should we want to preserve legacy behavior.
Lastly because of the library chosen I had to disable the noUnusedParamaters check in tsconfig.json.