-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: strict number validation (#65)
* feat: strict number
- Loading branch information
Showing
20 changed files
with
539 additions
and
138 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
"ajv-ts": minor | ||
--- | ||
|
||
Make [strict numbers](#strict-numbers) | ||
|
||
### Strict numbers | ||
|
||
We make validation for number `type`, `format`, `minValue` and `maxValue` fields. That means we handle it in our side so you get an error for invalid values. | ||
|
||
Examples: | ||
|
||
```ts | ||
s.number().format('float').int() // error in type! | ||
s.int().const(3.4) // error in type! | ||
s.number().int().format('float') // error in format! | ||
s.number().int().format('double') // error in format! | ||
|
||
// ranges are also check for possibility | ||
|
||
s.number().min(5).max(3) // error in range! | ||
s.number().min(3).max(5).const(10) // error in constant - out of range! | ||
``` | ||
|
||
## 🏡 Chore/Infra | ||
|
||
- add [type-fest](https://www.npmjs.com/package/type-fest) library for correct type checking | ||
- add [tsx](https://www.npmjs.com/package/tsx) package | ||
- add minified files for cjs and esm modules in `dist` folder | ||
- remove `bun-types` dependency |
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 |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
"ajv-ts": patch | ||
--- | ||
|
||
fix # 61 | ||
fix #61 |
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
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
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
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
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
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
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
Oops, something went wrong.