how can I fix the issue mentioned in assignment, I am new to typescript and zod? I tried to fix by using generics but failed to do so
I tried but not worked
code link: https://drive.google.com/drive/folders/178iLhpS21aY9AxgyXCP4uPaHXt5Zj7Ws
export function errorUnionSchema<T extends Array<ApiError<string, string>>>(errors: T) {
const schemaArray = errors.map(errorToSchema) as unknown as z.ZodType<z.infer<typeof errorToSchema<string, string>>>[];
return z.union(schemaArray) as z.ZodType<z.infer>;
}
Jay Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.