Tree shakable typebox helper utilities
npm install @hunterstack/typebox-helpersA collection of tree-shakable TypeBox helper utilities to make working with TypeBox even easier.
``bash`
npm install @hunterstack/typebox-helpers
- Tree-shakable utilities
- Type-safe helpers
- Zero dependencies (except TypeBox)
Create TypeBox union types from any literal values (strings, numbers, booleans) with full type safety:
`typescript
import { UnionOf } from '@hunterstack/typebox-helpers'
const Status = UnionOf(['active', 'inactive', 'pending'])
// TUnion<[TLiteral<"active">, TLiteral<"inactive">, TLiteral<"pending">]>
const Numbers = UnionOf([1, 2, 3, 4, 5])
// TUnion<[TLiteral<1>, TLiteral<2>, TLiteral<3>, TLiteral<4>, TLiteral<5>]>
const Mixed = UnionOf([1, 'red', true])
// TUnion<[TLiteral<1>, TLiteral<"red">, TLiteral
`
This package is thoroughly tested with a comprehensive approach:
`bashRun all tests
npm test
Development
`bash
Install dependencies
npm installRun tests
npm testRun benchmarks
npm run benchBuild
npm run build
``MIT