Skip to content

Commit

Permalink
Update changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin McDonnell committed Aug 1, 2021
1 parent 666a881 commit be330d2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Changelog

### 4.0
### 3.6

- Add IE11 support
- `ZodError.flatten` now optionally accepts a map function for customizing the output
- `.void()` now only accepts undefined, not null.

### 3.5
Expand Down
33 changes: 33 additions & 0 deletions deno/lib/playground.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { z } from "./index.ts";

const run = async () => {
z;

const propertySchema = z.string();
const schema = z
.object({
a: propertySchema,
b: propertySchema,
})
.refine(
(val) => {
return val.a === val.b;
},
{ message: "Must be equal" }
);

try {
schema.parse({
a: "asdf",
b: "qwer",
});
} catch (error) {
if (error instanceof z.ZodError) {
console.log(error);
console.log(error.flatten((iss) => iss.code));
}
}
};
run();

export {};

0 comments on commit be330d2

Please sign in to comment.