zod
zod copied to clipboard
V4: Zod could not resolve types when using `.instanceOf` with `.pipe`
Zod version: 3.25.28
import { z as z3 } from 'zod/v3';
import { z as z4 } from 'zod/v4';
const fn = (value: string) => Uint8Array.from(Buffer.from(value, 'base64'));
// Working with zod v3
z3.string().transform(fn).pipe(z3.instanceof(Uint8Array));
// Argument of type 'ZodCustom<Uint8Array<ArrayBuffer>, unknown>' is not assignable to parameter of type '$ZodType<any, Uint8Array<ArrayBuffer>>'.
z4.string().transform(fn).pipe(z4.instanceof(Uint8Array));