Skip to content

Conversation

jinwoo0103
Copy link

@jinwoo0103 jinwoo0103 commented Aug 4, 2025

This reverts commit bc09647 (PR #801).


I think #801 fix was not a typo.
When raw option is enabled, TTransformedValues should be z.input, not z.output.

function zodResolver<
  Input extends FieldValues,
  Context,
  Output,
  T extends z4.$ZodType<Output, Input> = z4.$ZodType<Output, Input>,
>(
  schema: z4.$ZodType<Output, Input>,
  schemaOptions: Zod4ParseParams | undefined, // already partial
  resolverOptions: RawResolverOptions,
): Resolver<z4.input<T>, Context, z4.output<T>>;
export type Resolver<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues> = (values: TFieldValues, context: TContext | undefined, options: ResolverOptions<TFieldValues>) => Promise<ResolverResult<TFieldValues, TTransformedValues>> | ResolverResult<TFieldValues, TTransformedValues>;

It breaks my project's type, when raw option is enabled.

TMI) For Zod v3, we can see TTransformedValues is correctly assigned when raw option is enabled as below.

export function zodResolver<Input extends FieldValues, Context, Output>(
  schema: Zod3Type<Output, Input>,
  schemaOptions: Zod3ParseParams | undefined,
  resolverOptions: RawResolverOptions,
): Resolver<Input, Context, Input>;

Please tell me if i'm wrong!
Thank you for reading my purpose!

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

Successfully merging this pull request may close these issues.

1 participant