-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed beta links to error handling guide
- Loading branch information
Colin McDonnell
committed
Jul 9, 2020
1 parent
5568a74
commit fd21959
Showing
3 changed files
with
43 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1183,7 +1183,7 @@ User.omit({ outer: { inner: { prop2: true } } }); // { outer: { prop1: string, i | |
|
||
## Errors | ||
|
||
There is a dedicated guide on Zod's error handling system here: [ERROR_HANDLING.md](https://github.com/vriad/zod/blob/beta/ERROR_HANDLING.md) | ||
There is a dedicated guide on Zod's error handling system here: [ERROR_HANDLING.md](https://github.com/vriad/zod/blob/master/ERROR_HANDLING.md) | ||
|
||
# Comparison | ||
|
||
|
@@ -1346,21 +1346,21 @@ If you want to validate function inputs, use function schemas in Zod! It's a muc | |
|
||
# Changelog | ||
|
||
| zod version | release notes | | ||
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| [email protected] | Added z.instanceof() and z.custom(). Implemented ZodSchema.array() method. | | ||
| [email protected] | Introduced z.void(). Major overhaul to error handling system, including the introduction of custom error maps. Wrote new [error handling guide](https://github.com/vriad/zod/blob/beta/ERROR_HANDLING.md). | | ||
| [email protected] | Added several built-in validators to string, number, and array schemas. Calls to `.refine` now return new instance. | | ||
| [email protected] | Any and unknown types | | ||
| [email protected] | Refinement types (`.refine`), `.parse` no longer returns deep clone | | ||
| [email protected] | Promise schemas | | ||
| [email protected] | `.parse` accepts `unknown`, `bigint` schemas | | ||
| [email protected] | `.partial` and `.deepPartial` on object schemas | | ||
| [email protected] | Date schemas | | ||
| [email protected] | `.pick`, `.omit`, and `.extend` on object schemas | | ||
| [email protected] | Records | | ||
| [email protected] | `.nonstrict` | | ||
| [email protected] | Type assertions with `.check` | | ||
| [email protected] | Empty tuples | | ||
| [email protected] | Type assertions, literals, enums, detailed error reporting | | ||
| [email protected] | Initial release | | ||
| zod version | release notes | | ||
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| [email protected] | Added z.instanceof() and z.custom(). Implemented ZodSchema.array() method. | | ||
| [email protected] | Introduced z.void(). Major overhaul to error handling system, including the introduction of custom error maps. Wrote new [error handling guide](https://github.com/vriad/zod/blob/master/ERROR_HANDLING.md). | | ||
| [email protected] | Added several built-in validators to string, number, and array schemas. Calls to `.refine` now return new instance. | | ||
| [email protected] | Any and unknown types | | ||
| [email protected] | Refinement types (`.refine`), `.parse` no longer returns deep clone | | ||
| [email protected] | Promise schemas | | ||
| [email protected] | `.parse` accepts `unknown`, `bigint` schemas | | ||
| [email protected] | `.partial` and `.deepPartial` on object schemas | | ||
| [email protected] | Date schemas | | ||
| [email protected] | `.pick`, `.omit`, and `.extend` on object schemas | | ||
| [email protected] | Records | | ||
| [email protected] | `.nonstrict` | | ||
| [email protected] | Type assertions with `.check` | | ||
| [email protected] | Empty tuples | | ||
| [email protected] | Type assertions, literals, enums, detailed error reporting | | ||
| [email protected] | Initial release | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,21 @@ | ||
// import * as z from '.'; | ||
// z.date().parse(new Date('invalid')); | ||
// // z.date().parse(new Date('invalid')); | ||
|
||
// // const myFunc = z.function(z.tuple([z.string()]), z.boolean()).implement(str => str.length > 5); | ||
|
||
// // try { | ||
// // myFunc(12 as any); | ||
// // } catch (err) { | ||
// // console.log(JSON.stringify(err, null, 2)); | ||
// // } | ||
|
||
// const $Cat = z.object({ | ||
// type: z.literal('cat'), | ||
// ability: z.literal('meow'), | ||
// }); | ||
// const $Dog = z.object({ | ||
// type: z.literal('dog'), | ||
// ability: z.literal('bark'), | ||
// }); | ||
// const $AnimalAbility = z.union([$Cat, $Dog]).distribute($A => $A.shape.ability); | ||
// type Ability = z.infer<typeof $AnimalAbility>; // "meow" | "bark" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters