🔧✨ Tiny helpers for TypeScript applications
Small, focused utilities you import one at a time — tree-shakeable ES modules with subpath exports.
- 🎯 High-quality module design
- âš¡ Lightweight sub-package exports
- 📦 Tree-shakeable ES modules
npm install @peerigon/typescript-toolkit --saveAlso available on JSR.
Import only the utilities you need. Each one is exposed as its own subpath:
import { assert } from "@peerigon/typescript-toolkit/assert";| Module | Description | Docs |
|---|---|---|
assert |
Assert a value is not null or undefined, with TypeScript narrowing |
→ |
need |
Assert a value is not null or undefined and return it with a narrowed type |
→ |
dedupe |
Remove duplicate values from an array while preserving first-occurrence order | → |
enums |
Lightweight string-enum alternative for erasableSyntaxOnly TypeScript projects |
→ |
match |
Exhaustive pattern matching with compile-time case checks, similar to switch |
→ |
result |
Type-safe error handling with pending, success, and error states | → |
unwrap |
Extract values from Result or nullable types, with optional fallback support |
→ |