Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

z.coerce in ts-to-zod #201

Closed
fucksophie opened this issue Feb 6, 2024 · 4 comments
Closed

z.coerce in ts-to-zod #201

fucksophie opened this issue Feb 6, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@fucksophie
Copy link

Feature description

A comment such as

/*
* @coerce true
*/
hello: number;

will turn the resulting z.number() into z.coerce.number()

Input

/*
* @coerce true
*/
hello: number;

Output

hello: z.coerce.number()
@schiller-manuel
Copy link
Collaborator

Feel free to create a PR!

@fucksophie
Copy link
Author

Just saw, this feature has been implemented in #125, just that the PR's author hasn't written any tests for it yet..

@tvillaren tvillaren added the enhancement New feature or request label Mar 6, 2024
@schiller-manuel
Copy link
Collaborator

https://github.com/fabien0102/ts-to-zod/releases/tag/v3.13.0 allows to append to a schema, does this solve your issue?

@fucksophie
Copy link
Author

Yup, does.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants