Installation
What’s Included
Type Utilities
Advanced TypeScript type transformations including Prettify, Writeable, and union manipulation utilities
Guards & Assertions
Runtime type guards and assertion functions for safe type narrowing
Enum Utilities
Type-safe enum creation with powerful type inference capabilities
Quick Start
Type Guards
Use type guards to safely narrow types at runtime:Type Utilities
Transform complex types with ease:Assertions
Enforce type constraints with assertions:Enums
Create type-safe enums with union extraction:Features
Type Transformations
Type Transformations
- Prettify: Flatten intersection types for better IntelliSense
- Writeable: Remove readonly modifiers (shallow or deep)
- UnmaskType: Display computed types instead of aliases
- DistributiveOmit/Pick: Omit or pick properties from union types
Runtime Type Checking
Runtime Type Checking
- Primitive guards:
isString,isNumber,isBoolean,isSymbol - Object guards:
isObject,isPlainObject,isArray - Special guards:
isPromise,isFunction,isAsyncFunction - Serialization guards:
isJSONSerializable,isValidJsonString
Assertions
Assertions
assert: General assertion with custom messagesassertDefined: Assert non-null/undefined valuesassertENV: Validate environment variablesAssertionError: Custom error class for failures
Advanced Union Types
Advanced Union Types
ExtractUnion: Extract union types from objects or arraysUnionDiscriminator: Create discriminated unionsUnionToIntersection: Convert unions to intersectionsLiteralUnion: Combine literal types with autocomplete
Package Information
- Package:
@zayne-labs/toolkit-type-helpers - Version: 0.12.43
- License: MIT
- Repository: github.com/zayne-labs/toolkit
Next Steps
Type Utilities
Explore type transformation utilities
Guards & Assertions
Learn about runtime type safety
Enums
Create type-safe enums