Superfast runtime validators with only one line
npm install typia






``typescript
// RUNTIME VALIDATORS
export function is
export function assert
export function assertGuard
export function validate
// JSON FUNCTIONS
export namespace json {
export function schema
export function assertParse
export function assertStringify
}
// AI FUNCTION CALLING SCHEMA (): ILlmSchema.IParameters; // PROTOCOL BUFFER // RANDOM GENERATOR typia - Super-fast Runtime Validators > [!NOTE]
export namespace llm {
// collection of function calling schemas
export function application
export function controller
name: string,
execute: Class,
): ILlmController; // +executor
// structured output
export function parameters
export function schema
$defs: Record
): ILlmSchema; // type schema
}
export namespace protobuf {
export function message
export function assertDecode
export function assertEncode
}
export function random
` is a transformer library supporting below features:
- Enhanced JSON schema and serde functions
- LLM function calling schema and structured output
- Protocol Buffer encoder and decoder
- Random data generator
>
> - Only one line required, with pure TypeScript type
> - Runtime validator is 20,000x faster than class-validatorclass-transformer
> - JSON serialization is 200x faster than 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 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.
`typescript
//----
// examples/checkString.ts
//----
import typia, { tags } from "typia";
export const checkString = typia.createIs
//----
// examples/checkString.js
//----
import typia from "typia";
export const checkString = (() => {
return (input) => "string" === typeof input;
})();
`
Your donation encourages typia development.
Also, typia is re-distributing half of donations to core contributors of typia.
- nonara/ts-patch
- ryoppippi/unplugin-typia

- 💻 https://typia.io/playground
function function function functions functions function function function functions functions Articles