
Transform pure TypeScript types into
20,000x faster runtime validators, JSON serializers, and LLM schemas
Zero schema. Zero overhead. Just TypeScript.
AOT Compilation Magic
Write TypeScript types as you normally would. At compile time, typia analyzes the AST and generates dedicated, optimized validation code.
Your TypeScript Code
import typia, { tags } from "typia";
interface IMember {
id: string & tags.Format<"uuid">;
email: string & tags.Format<"email">;
age: number &
tags.Type<"uint32"> &
tags.ExclusiveMinimum<19> &
tags.Maximum<100>;
}
// just one line, with pure TypeScript type
const check: boolean = typia.is<IMember>(input);Compiled Output
// compiled JavaScript β no schema overhead
((input) => {
return (
"object" === typeof input &&
null !== input &&
"string" === typeof input.id &&
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5].*$/.test(input.id) &&
"string" === typeof input.email &&
/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$/.test(input.email) &&
"number" === typeof input.age &&
Number.isInteger(input.age) &&
input.age >= 0 &&
19 < input.age &&
100 >= input.age
);
})Key Features
One library. Pure TypeScript types. Every runtime feature you need.
Why AOT Compilation?
Traditional validators parse schemas at runtime. Typia generates dedicated validation code at compile time β the difference is measured in orders of magnitude.
Traditional Approach
β
Define a separate schema object (Zod, io-ts, class-validator decorators)
β
Schema is parsed and interpreted at every function call β runtime overhead
β
TypeScript type and schema easily drift apart β double maintenance
β
Complex union types and nested objects require verbose, manual handling
Typia β AOT Compilation
β
Write pure TypeScript types β no schema DSL, no decorators, no duplication
β
Compiler analyzes the type AST and emits optimized native code β zero runtime parsing
β
Type and validator are always in sync β single source of truth
β
Full support for unions, intersections, recursion, template literals, and tagged types
LLM Function Calling
Generate function calling schemas directly from TypeScript types.
Validation feedback boosts up LLM function calling success rates.
LLM Integration
import { LlmJson } from "@typia/utils";
import typia, { tags } from "typia";
class ShoppingOrderController {
/** some description comment for AI */
create(input: IShoppingOrderCreate): void;
}
// Generate application
const app = typia.llm.application<ShoppingOrderController>();
const func = app.functions[0];
// Lenient parse + validation feedback
const data = func.parse(llmOutput);
const result = func.validate(data);
if (result.success === false)
const feedback = LlmJson.stringify(result);β
Validation Feedback
Validate LLM output with typia.validate, then feed IValidation.IFailure back to the LLM for self-correction
π§
Lenient JSON Parsing
Recover from malformed JSON that LLMs frequently produce β broken quotes, trailing commas, missing brackets
π
Type Coercion
Automatically cast LLM string responses to proper TypeScript types β "1" becomes number 1
π
Schema Generation
Generate function calling schemas directly from pure TypeScript types. No manual schema writing needed
Sponsors
Thanks for your support. Your donation encourages typia development.
Also, typia is re-distributing quarter of donations to nonara/ts-patch.