TanStackT
TanStack11mo ago
3 replies
unexpected-ivory

[TypeScript] Passing field.state.meta.errors to child component

Trying to figure out what the type is for field.state.meta.errors to properly type a child component. It appears to be StandardSchemaV1Issue[] when you inspect the individual objects but when passing it to the child, I get a TypeScript error like this:
Type 'UnwrapOneLevelOfArray<UnwrapFieldValidateOrFn<{ email: string; password: string; }, "email", FieldValidateOrFn<{ email: string; password: string; }, "email", string> | undefined, ZodObject<{ email: ZodString; password: ZodString; }, "strip", ZodTypeAny, { ...; }, { ...; }>>>[]' is not assignable to type 'StandardSchemaV1Issue[]'.
  Type 'UnwrapOneLevelOfArray<UnwrapFieldValidateOrFn<{ email: string; password: string; }, "email", FieldValidateOrFn<{ email: string; password: string; }, "email", string> | undefined, ZodObject<{ email: ZodString; password: ZodString; }, "strip", ZodTypeAny, { ...; }, { ...; }>>>' is not assignable to type 'StandardSchemaV1Issue'.
    Type 'undefined' is not assignable to type 'StandardSchemaV1Issue'.
Was this page helpful?