error TS2769: No overload matches this call.
Overload 1 of 3, '(callbackfn: (previousValue: ZodLiteral<"once"> | ZodLiteral<"repeating"> | ZodLiteral<"forever">, currentValue: ZodLiteral<"once"> | ZodLiteral<"repeating"> | ZodLiteral<...>, currentIndex: number, array: (ZodLiteral<...> | ... 1 more ... | ZodLiteral<...>)[]) => ZodLiteral<...> | ... 1 more ... | ZodLiteral<...>, initialValue: ZodLiteral<...> | ... 1 more ... | ZodLiteral<...>): ZodLiteral<...> | ... 1 more ... | ZodLiteral<...>', gave the following error.
Argument of type '(errors: ZodError<any>[], schema: ZodLiteral<"once"> | ZodLiteral<"repeating"> | ZodLiteral<"forever">) => (ZodError<any> | undefined)[]' is not assignable to parameter of type '(previousValue: ZodLiteral<"once"> | ZodLiteral<"repeating"> | ZodLiteral<"forever">, currentValue: ZodLiteral<"once"> | ZodLiteral<"repeating"> | ZodLiteral<...>, currentIndex: number, array: (ZodLiteral<...> | ... 1 more ... | ZodLiteral<...>)[]) => ZodLiteral<...> | ... 1 more ... | ZodLiteral<...>'.
Types of parameters 'errors' and 'previousValue' are incompatible.
Type 'ZodLiteral<"once"> | ZodLiteral<"repeating"> | ZodLiteral<"forever">' is not assignable to type 'ZodError<any>[]'.
Type 'ZodLiteral<"once">' is missing the following properties from type 'ZodError<any>[]': length, pop, push, concat, and 35 more.
Overload 2 of 3, '(callbackfn: (previousValue: ZodError<any>[], currentValue: ZodLiteral<"once"> | ZodLiteral<"repeating"> | ZodLiteral<"forever">, currentIndex: number, array: (ZodLiteral<...> | ... 1 more ... | ZodLiteral<...>)[]) => ZodError<...>[], initialValue: ZodError<...>[]): ZodError<...>[]', gave the following error.
Argument of type '(errors: ZodError<any>[], schema: ZodLiteral<"once"> | ZodLiteral<"repeating"> | ZodLiteral<"forever">) => (ZodError<any> | undefined)[]' is not assignable to parameter of type '(previousValue: ZodError<any>[], currentValue: ZodLiteral<"once"> | ZodLiteral<"repeating"> | ZodLiteral<"forever">, currentIndex: number, array: (ZodLiteral<...> | ... 1 more ... | ZodLiteral<...>)[]) => ZodError<...>[]'.
Type '(ZodError<any> | undefined)[]' is not assignable to type 'ZodError<any>[]'.
Type 'ZodError<any> | undefined' is not assignable to type 'ZodError<any>'.
Type 'undefined' is not assignable to type 'ZodError<any>'.
2802 (errors: z.ZodError[], schema) =>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2803 ((result) =>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
2805 schema.safeParse(x),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2806 ),
~~~~~~~~~~~~~~~~~~~~~~~
In the latest versions of Zod (3.23.8) and TypeScript (5.4.5) this generated code: https://github.com/StefanTerdell/json-schema-to-zod/blob/969a0b912f56601e69cebcb2e0b212275be0d191/src/parsers/parseOneOf.ts#L23-L29 throw this TypeScript error: