-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(types): new
NumberBetween
and StringOfLength
types
- Loading branch information
1 parent
e70b034
commit a6b567f
Showing
3 changed files
with
22 additions
and
0 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
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,10 @@ | ||
import { AnyNumber } from './any-number.type'; | ||
/** | ||
* A `number` type or an instance of a `Number` with the specified range. | ||
* Generic variables `Min` and `Max` are constrained with the `number` type. | ||
*/ | ||
export type NumberBetween<Min extends number, Max extends number> = | ||
AnyNumber & { | ||
min: Min; | ||
max: Max; | ||
}; |
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,10 @@ | ||
import { AnyString } from './any-string.type'; | ||
/** | ||
* A `string` type or an instance of a `String` with its specified minimum and maximum length. | ||
* Generic variables `Min` and `Max` are constrained with the `number` type. | ||
*/ | ||
export type StringOfLength<Min extends number, Max extends number> = | ||
AnyString & { | ||
min: Min; | ||
max: Max; | ||
}; |