I'm running into a types issue with Zod where my fetcher is supposed to return this type:
field: string;
result: z.SafeParseReturnType<SchemaInput, SchemaOutput>;
I understand that it must be serialised, that's not my problem. My problem is I get an "Unsafe assignment of an any value." error due to the following issue: Property 'success' does not exist on type 'SerializeObject<UndefinedToOptional<SafeParseSuccess<SchemaOutput>>>'
I don't know why the success boolean is not available after being serialised, I suspect that this is a bug. The type is being set in the useFetcher generic:
useFetcher<{
field: string;
result: z.SafeParseReturnType<SchemaInput, SchemaOutput>;
}>();
Does anyone know why this might be happening?
Zod 3.21.4
Remix 1.15.0