Shared
Generic types, type guards and utilities commonly used across packages.
Type guards
Convenient TypeScript type guards for everyday usage.
These type guards make your code more explicit, readable, and type-safe — both at runtime and in TypeScript's flow analysis.
- Generic:
- Array:
- String:
- isString
- isEmptyString
- isNotEmptyString
- isDecimalMonetaryValue - decimal-formatted numeric string, e.g. currency amounts
- Number:
- Boolean:
Utils
Utility functions that helps with everyday tasks:
- getErrorMessage - Get typesafe Error object message.
- emptyFn - Useful default react prop callback value.
- cs - Conditional styling util.
- getDefined - Get fallback value if passed variable is not defined.
- wait - Promise-based sleep via
setTimeout.
Types
Commonly used typescript types:
- ClassType
- Maybe
- OnEventFn
- EmptyFn
- Enum
- IsNotEmptyArray
- ReadonlyIsNotEmptyArray
- AnyFn
- AbstractConstructor
- MethodDecoratorType
License
This library is licensed under The MIT License.