@infra-blocks/zod-utils 0.20.0-alpha.0 → 0.20.0-alpha.2
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.
- package/README.md +3 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
[](https://github.com/infra-blocks/ts-zod-utils/actions/workflows/release.yml)
|
|
4
4
|
[](https://codecov.io/gh/infra-blocks/ts-zod-utils)
|
|
5
5
|
|
|
6
|
-
|
|
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
|
|
|
@@ -373,11 +375,6 @@ if (isMin5String(myString)) {
|
|
|
373
375
|
}
|
|
374
376
|
```
|
|
375
377
|
|
|
376
|
-
It can still be used with vanilla types, but then the guarantees returned by a type guard are
|
|
377
|
-
not as strong. In our specific case, the type guard would assert that `myString` is a `string`,
|
|
378
|
-
despite the fact that it also checked that its length has to be greater than 5. That information
|
|
379
|
-
has been lost.
|
|
380
|
-
|
|
381
378
|
### Is Valid
|
|
382
379
|
|
|
383
380
|
The `isValid` API is very similar to the [type guard](#type-guard) one, except it doesn't bind
|