-
Notifications
You must be signed in to change notification settings - Fork 68
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
Fixes #36 | Allows for single value unions #37
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! 🎉
Codecov Report
@@ Coverage Diff @@
## main #37 +/- ##
==========================================
- Coverage 98.49% 98.05% -0.45%
==========================================
Files 8 9 +1
Lines 332 359 +27
Branches 102 108 +6
==========================================
+ Hits 327 352 +25
- Misses 5 6 +1
- Partials 0 1 +1
Continue to review full report at Codecov.
|
@@ -168,6 +168,13 @@ describe("generateZodSchema", () => { | |||
); | |||
}); | |||
|
|||
it("should generate a literal schema for a single union", () => { | |||
const source = `export type Identity = | "superman";`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not even aware of this notation 😅 make totally sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha ya I use it to remind myself this will be a union but haven't filled out everything yet. Typescript is pretty rad :P (And so is ts-to-zod, it's super useful!!)
Why
Fixes #36. Handles single value unions how typescript handles them.