-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make runtime type checks TS-friendly (#73)
This commit makes minor refactors to runtime type checks to make that validation more TS-friendly: * Replace `Type(x)` for validating `Object` with a type guard `IsObject` function. The function is overloaded so unknown values are typed as `Record`, while known types like `DurationLike | string` are simply stripped of primitive types while leaving the object types. As a nice side effect, this should reduce bundle size a little bit. * For the other uses of ES.Type (there were <5 of them) , convert to simple typeof checks, which are also TS type guards. * Remove the ES.Type function * Add type annotations to make all IsTemporalXxx into TS type guards
- Loading branch information
1 parent
27b4c7e
commit 06b806c
Showing
9 changed files
with
61 additions
and
71 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
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.