-
Notifications
You must be signed in to change notification settings - Fork 70
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
Problem getting imports to work #242
Comments
Ah, forgot to mention, that I uploaded these to a repo as well: https://github.com/pkyeck/test-ts-to-zod |
Hello @pkyeck Indeed, the validation fails because the generated file (which you can check by passing the // Generated by ts-to-zod
import { z } from "zod";
import { templateTypeSchema } from "./a.zod";
export const tAudioDataSchema = z.object({
a: z.string(),
b: z.string().optional(),
});
export const tAudioRequestSchema = z
.object({
_template: z.literal(TemplateType.Audio),
})
.and(tAudioDataSchema); The imported So it looks like there is an issue with enum imports here... |
Ah, thank you. The "Problem" with enums is, that you can use them as types or values, so we could need both the schema but also the enum itself...
|
I think it's a bug (or a missing feature 😅) |
Bug description
I'm trying to generate zods from our types. We have a lot of files and some of them use types from others. I wrote a script collecting all the filenames and generating a config file (like mentioned here #151) ... looks good so far ... but. I have a problem with the import of another type from a different file:
and my config looks like this:
If I now run
yarn ts-to-zod --all
I get the following error:If I put all types in one file and run
ts-to-zod
no error is thrown – so I guess I broke the imports 🤷♂️This should work, right?! Is my config not correct or why am I getting these weird errors?
Versions
"ts-to-zod": "^3.8.5"
The text was updated successfully, but these errors were encountered: