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 redundancy and performance overhead associated with traditional runtime type checking and JSON serialization in TypeScript applications.

How it works

Instead of using runtime reflection or external schemas, Typia analyzes TypeScript types at build time. It transforms pure TypeScript types directly into highly optimized, dedicated runtime functions for validation, JSON parsing, and serialization. This process requires a specific toolchain (ttsc and ttsx) to perform the the transformation during compilation.

Who it’s for

Developers using TypeScript who need high-performance runtime type safety, automated JSON schema generation, or a structured way to handle LLM function calling and structured outputs.

Highlights

  • Extreme Performance: Runtime validators are up to 20,000x faster than class-validator and JSON serialization is up to 200x faster than class-transformer.
  • Zero Schema Redundancy: Uses pure TypeScript types as the single source of truth for validation and serialization.
  • LLM Integration: Includes a dedicated harness for LLM function calling, structured outputs, and evaluation models, significantly improving accuracy.
  • Broad Utility: Supports Protocol Buffer encoding/decoding and random data generation based on types.
  • Build-time Transformation: Compiles types into functions, avoiding runtime reflection overhead.

Related

  • Project
  • Project
  • Project
  • Project
  • Project