zod
zod copied to clipboard
Property 'infer' does not exist
I had the same issue, because I also had @types/zod
in package.json
.
i have the same issue, but i don't have installed @types/zod
FWIW, my mistake was using const
instead of type
:
export const Model = z.infer<typeof Schema>;
-- error
export type Model = z.infer<typeof Schema>;
-- no error
I've found that z.infer
is considered non-existent unless you assign the result of it to a type.
z.infer<typeof MySchema> // error
type MySchemaType = z.infer<typeof MySchema> // good
Has this issue been resolved? If so, I would like to close this issue.
Has this issue been resolved? If so, I would like to close this issue.
Resolved for me, yes