zod icon indicating copy to clipboard operation
zod copied to clipboard

V4: Recursive object throws `RangeError` when using `.shape` on it

Open hibanka opened this issue 7 months ago • 0 comments

Zod version: [email protected]

import { z } from 'zod/v4';

const Transfer = z.object({
  id: z.string(),
  get counterpartyId() {
    return Transfer.shape.id;
  },
});

// RangeError: Maximum call stack size exceeded
const hello = z.object({ id: Transfer.shape.id });

hibanka avatar May 17 '25 14:05 hibanka