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

Property 'innerType' does not exist on type 'ZodAnyDef'. #22

Open
DystopianDisco opened this issue Aug 6, 2023 · 1 comment
Open

Property 'innerType' does not exist on type 'ZodAnyDef'. #22

DystopianDisco opened this issue Aug 6, 2023 · 1 comment

Comments

@DystopianDisco
Copy link

great component. works smoothly locally but but not deploying due to two issues in the auto-form.tsx

  1. Property 'innerType' does not exist on type 'ZodAnyDef'.
  2. Property 'schema' does not exist on type 'ZodAnyDef'.

related to line 62 and 66:

"function getBaseSchema(schema: z.ZodAny): z.ZodAny {
if ("innerType" in schema._def) {

return getBaseSchema(schema._def.innerType as z.ZodAny);

}
if ("schema" in schema._def) {

return getBaseSchema(schema._def.schema as z.ZodAny);

}
return schema;
}"

Building on Next.js 13 using Shadcn Taxonomy. Any ideas how to fix?

@JheanAntunes
Copy link

//explaining
@DystopianDisco kkkk, I have the same problem... In order not to comment on this part, I used this alternative (The error stopped, but this does not confirm that it is correct!)
const schemanew: any = { ...schema }; //spread Operator (Get all properties) and added a type any
if ("_def" in schemanew && "innerType" in schemanew._def) { // if these properties exist;
schemanew._def.innerType as z.ZodAny;//I changed the type of the property and then passed it as an argument;
return getBaseSchema(schemanew._def.innerType);
}
//código
if ("innerType" in schema._def) {
const schemanew: any = { ...schema };
if ("_def" in schemanew && "innerType" in schemanew._def) {
schemanew._def.innerType as z.ZodAny;
return getBaseSchema(schemanew._def.innerType);
}
}

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

No branches or pull requests

2 participants