zod icon indicating copy to clipboard operation
zod copied to clipboard

Property 'infer' does not exist

Open 7flash opened this issue 2 years ago • 2 comments

image

7flash avatar Jun 24 '22 02:06 7flash

I had the same issue, because I also had @types/zod in package.json.

mike-hogan avatar Jul 18 '22 11:07 mike-hogan

i have the same issue, but i don't have installed @types/zod

gino8080 avatar Aug 29 '22 18:08 gino8080

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

cbrown01 avatar Oct 11 '22 14:10 cbrown01

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

chinanderm avatar Oct 20 '22 02:10 chinanderm

Has this issue been resolved? If so, I would like to close this issue.

JacobWeisenburger avatar Jan 05 '23 03:01 JacobWeisenburger

Has this issue been resolved? If so, I would like to close this issue.

Resolved for me, yes

mike-hogan avatar Jan 05 '23 08:01 mike-hogan