Skip to content

Commit

Permalink
Clear playground
Browse files Browse the repository at this point in the history
  • Loading branch information
colinhacks committed Apr 21, 2024
1 parent 6c6161f commit 8a5075e
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions playground.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
import { z } from "./src";

z;

/* eslint-env mocha */

// const { z, ZodError } = require('zod')

// describe('zod', function () {
// it('cannot deal with circular data structures', function () {
const AnObjectSchema = z.object({ someLiteralProperty: z.literal(1) });

const cicrularObject: any = {
aProperty: "a property",
anotherProperty: 137,
anObjectProperty: { anObjectPropertyProperty: "an object property property" },
anArrayProperty: [
{ anArrayObjectPropertyProperty: "an object property property" },
],
};
cicrularObject.anObjectProperty.cicrularObject = cicrularObject;
cicrularObject.anArrayProperty.push(cicrularObject.anObjectProperty);
const violatingObject = { someLiteralProperty: cicrularObject };

const { success, error } = AnObjectSchema.safeParse(violatingObject);

console.log({ success, error });
// })
// })

0 comments on commit 8a5075e

Please sign in to comment.