samchon/typia
Super-fast/easy runtime validators and serializers via transformation
What it solves
Typia is a transformer library that eliminates the need to write separate runtime validation schemas for TypeScript types. It solves the problem of duplication between static type definitions and runtime checks, providing a high-performance way to ensure type safety without the overhead of runtime reflection or manual schema definition.
How it works
Typia uses a custom compilation step (via the ttsc toolchain) to analyze TypeScript types at build time. It transforms these static types directly into optimized, dedicated runtime validation functions, JSON serializers, or Protocol Buffer encoders. Instead of relying on runtime reflection, the code is compiled into pure JavaScript that performs the same checks as the the TypeScript type.
Who it’s for
Developers using TypeScript who need high-performance runtime validation, type-safe JSON parsing, and structured data handling for LLM function calling or Protocol Buffers.
Highlights
- Extreme Performance: Runtime validators are up to 20,000x faster than
class-validatorand JSON serialization is 200x faster thanclass-transformer. - LLM Integration: Includes a dedicated harness for LLM function calling and structured output, which the project claims increases accuracy from 6.75% to 100%.
- Coded at Build Time: No runtime reflection or schemas are required; it transforms pure TypeScript types into executable code.
- Broad Utility: Supports JSON schema generation, Protocol Buffer encoding/decoding, and random data generation based on types.
Related
- Project
- Project
- Project
- Project
- Project