@infra-blocks/zod-utils 0.20.0-alpha.1 → 0.20.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +6 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -3,7 +3,9 @@
3
3
  [![Release](https://github.com/infra-blocks/ts-zod-utils/actions/workflows/release.yml/badge.svg)](https://github.com/infra-blocks/ts-zod-utils/actions/workflows/release.yml)
4
4
  [![codecov](https://codecov.io/gh/infra-blocks/ts-zod-utils/graph/badge.svg?token=Q9ZLX7AMPH)](https://codecov.io/gh/infra-blocks/ts-zod-utils)
5
5
 
6
- This package exposes various utilities extending the [zod](https://www.npmjs.com/package/zod) package.
6
+ [zod](https://www.npmjs.com/package/zod) is an amazing parsing library. This package aims to extend it with various utilities
7
+ that I've found useful through my own programming. Those include schemas I find myself writing often, codecs that are
8
+ shown in Zod's documentation but not yet available, and type utilities.
7
9
 
8
10
  ## Branded types
9
11
 
@@ -14,9 +16,9 @@ When branding is used, the brand is a string that's the same as the name of the
14
16
  is an alias for `string & z.$brand<"AwsAccountId">`.
15
17
 
16
18
  One caveat of using branded types schema is that the default value must also be branded (as should be). So,
17
- for example, where you would write `z.int().default(5)`, you instead have to write `zu.integer().default(zu.integer().parse(5))`.
18
- This is, however, exactly correct. Indeed, with vanilla zod, you could write `z.int().default(123.456)`, which violates
19
- the schema and is accepted both at compile time and runtime at the time of this writing.
19
+ for example, where you would write `z.int().default(5)`, you instead have to write `zu.number.integer().default(zu.number.integer().parse(5))`.
20
+ This example also highlights an inconsistency with Zod where you can have `z.int().default(123.456)`, which both
21
+ compiles and runs successfully.
20
22
 
21
23
  ## API
22
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infra-blocks/zod-utils",
3
- "version": "0.20.0-alpha.1",
3
+ "version": "0.20.0-alpha.3",
4
4
  "description": "Extensions to the zod package.",
5
5
  "keywords": [
6
6
  "zod",