Closed
Description
const schema = z.object({
a: z.string(),
b: z.number(),
c: z.boolean(),
});
const test: z.core.$ZodObject = schema;
// ___^^^^^
TS2322: Type 'ZodObject<{ a: ZodString; b: ZodNumber; c: ZodBoolean; }, {}, {}>' is not assignable to type '$ZodObject<Readonly<Readonly<{ [k: string]: $ZodType<unknown, unknown>; }>>, Record<string, unknown>, Record<string, unknown>>'.
Types of property '_zod' are incompatible.
Type '$ZodObjectInternals<{ a: ZodString; b: ZodNumber; c: ZodBoolean; }, {}, {}>' is not assignable to type '$ZodObjectInternals<Readonly<Readonly<{ [k: string]: $ZodType<unknown, unknown>; }>>, Record<string, unknown>, Record<string, unknown>>'.
Type 'Readonly<Readonly<{ [k: string]: $ZodType<unknown, unknown>; }>>' is missing the following properties from type '{ a: ZodString; b: ZodNumber; c: ZodBoolean; }': a, b, c
So that any function expecting $ZodObject
argument or a generic argument extending it can no longer accept the returns of z.object()
having populated shape.
caused by #4271
@colinhacks
Metadata
Metadata
Assignees
Labels
No labels