You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// RUNTIME VALIDATORSexportfunctionis<T>(input: unknown): input is T;// returns booleanexportfunctionassert<T>(input: unknown): T;// throws TypeGuardErrorexportfunctionassertGuard<T>(input: unknown): asserts input is T;exportfunctionvalidate<T>(input: unknown): IValidation<T>;// detailed// JSON FUNCTIONSexportnamespacejson{exportfunctionapplication<T>(): IJsonApplication;// JSON schemaexportfunctionassertParse<T>(input: string): T;// type safe parserexportfunctionassertStringify<T>(input: T): string;// safe and faster}// AI FUNCTION CALLING SCHEMAexportnamespacellm{// collection of function calling schemasexportfunctionapplication<Class,Model>(): ILlmApplication<Class>;exportfunctioncontroller<Class,Model>(name: string,execute: Class,): ILlmController<Model>;// +executor// structured outputexportfunctionparameters<P,Model>(): ILlmSchema.IParameters<Model>;exportfunctionschema<T,Model>(): ILlmSchema<Model>;// type schema}// PROTOCOL BUFFERexportnamespaceprotobuf{exportfunctionmessage<T>(): string;// Protocol Buffer messageexportfunctionassertDecode<T>(buffer: Uint8Array): T;// safe decoderexportfunctionassertEncode<T>(input: T): Uint8Array;// safe encoder}// RANDOM GENERATORexportfunctionrandom<T>(g?: Partial<IRandomGenerator>): T;
typia is a transformer library supporting below features:
Super-fast Runtime Validators
Enhanced JSON schema and serde functions
LLM function calling schema and structured output
Protocol Buffer encoder and decoder
Random data generator
Note
Only one line required, with pure TypeScript type
Runtime validator is 20,000x faster than class-validator
JSON serialization is 200x faster than class-transformer
Transformation
If you call typia function, it would be compiled like below.
This is the key concept of typia, transforming TypeScript type to a runtime function. The typia.is<T>() function is transformed to a dedicated type checker by analyzing the target type T in the compilation level.
This feature enables developers to ensure type safety in their applications, leveraging TypeScript's static typing while also providing runtime validation. Instead of defining additional schemas, you can simply utilize the pure TypeScript type itself.