Skip to content
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

feat: Generate inferred types #85

Merged
merged 4 commits into from Mar 13, 2023
Merged

feat: Generate inferred types #85

merged 4 commits into from Mar 13, 2023

Conversation

fabien0102
Copy link
Owner

Why

If you want to tweak the generated zod schemas, you can't used the original types (they will be out of sync).

For supporting this usecase, this PR is adding a inferredTypes options to provide a file path.

Note

We are generating inferred types in a separate file to avoid any name conflicts, indeed, when you have a circular types, we are using the original type as hint for zod.

Related issue

#81

@@ -0,0 +1,36 @@
// Generated by ts-to-zod
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SrBrahma Can you have a look to the generated file and tell me if this could fit your usecase

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am kinda busy those days (moving abroad very soon!), but asap will try it and give you the feedback.

@fabien0102 fabien0102 merged commit 250f64d into main Mar 13, 2023
@fabien0102 fabien0102 deleted the inferred-types branch March 13, 2023 07:09
fracalo added a commit to fracalo/ts-to-zod that referenced this pull request Apr 7, 2023
* upstream/main:
  fix: support numeric literal keys (fabien0102#120)
  chore: release 3.0.0 (fabien0102#119)
  feat: Generate inferred types (fabien0102#85)
  feat!: Support circular dependencies with loops of length > 1 (fabien0102#114)
  build: add missing dependency on @oclif/errors (fabien0102#115)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants