Gathering detailed insights and metrics for typia
Gathering detailed insights and metrics for typia
Super-fast/easy runtime validators and serializers via transformation
npm install typia
Typescript
Module System
Node Version
NPM Version
95.3
Supply Chain
97.2
Quality
94.2
Maintenance
100
Vulnerability
98.6
License
TypeScript (95.53%)
MDX (4.34%)
JavaScript (0.12%)
HTML (0.01%)
Total Downloads
4,354,058
Last Day
24,861
Last Week
123,725
Last Month
420,458
Last Year
3,425,334
4,836 Stars
2,189 Commits
163 Forks
16 Watching
4 Branches
80 Contributors
Minified
Minified + Gzipped
Latest Version
7.6.1
Package Id
typia@7.6.1
Unpacked Size
3.77 MB
Size
580.86 kB
File Count
2,043
NPM Version
10.8.2
Node Version
20.18.2
Publised On
03 Feb 2025
Cumulative downloads
Total Downloads
Last day
6%
24,861
Compared to previous day
Last week
18%
123,725
Compared to previous week
Last month
6.4%
420,458
Compared to previous month
Last year
273%
3,425,334
Compared to previous year
2
17
1// RUNTIME VALIDATORS 2export function is<T>(input: unknown): input is T; // returns boolean 3export function assert<T>(input: unknown): T; // throws TypeGuardError 4export function assertGuard<T>(input: unknown): asserts input is T; 5export function validate<T>(input: unknown): IValidation<T>; // detailed 6 7// JSON FUNCTIONS 8export namespace json { 9 export function application<T>(): IJsonApplication; // JSON schema 10 export function assertParse<T>(input: string): T; // type safe parser 11 export function assertStringify<T>(input: T): string; // safe and faster 12} 13 14// LLM FUNCTION CALLING SCHEMA 15export namespace llm { 16 // application schema from a class or interface type 17 export function application<App, Model>(): ILlmApplication<Model>; 18 // structured output 19 export function parameters<P, Moodel>(): ILlmSchema.IParameters<Model>; 20 export function schema<T, Model>(): ILlmSchema<Model>; // type schema 21} 22 23// PROTOCOL BUFFER 24export namespace protobuf { 25 export function message<T>(): string; // Protocol Buffer message 26 export function assertDecode<T>(buffer: Uint8Array): T; // safe decoder 27 export function assertEncode<T>(input: T): Uint8Array; // safe encoder 28} 29 30// RANDOM GENERATOR 31export function random<T>(g?: Partial<IRandomGenerator>): T;
typia
is a transformer library supporting below features:
[!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
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.
1//---- 2// examples/checkString.ts 3//---- 4import typia, { tags } from "typia"; 5export const checkString = typia.createIs<string>(); 6 7//---- 8// examples/checkUUID.js 9//---- 10import typia from "typia"; 11export const checkString = (() => { 12 return (input) => "string" === typeof input; 13})();
Thanks for your support.
Your donation encourages typia
development.
Also, typia
is re-distributing half of donations to core contributors of typia
.
You can experience how typia works by playground website:
Check out the document in the website:
dev.to
ArticlesNo vulnerabilities found.
No security vulnerabilities found.