@frauschert/ts-guard
v1.0.0
Published
ts-guard is a typescript library that provides composable type guards. Its inspired by zod but focusses only on type guards and is more lightweight.
Downloads
4
Maintainers
Readme
ts-guard
ts-guard is a typescript library that provides composable type guards. Its inspired by zod but focusses only on type guards and is more lightweight.
Usage
import { isObject, isString, isNumber } from 'ts-guard';
const isPerson = isObject({ name: isString, age: isNumber });
const someValue = ...
if(isPerson(someValue)) {
/// someValue is Person
}
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.