woutervh- / typescript-is

MIT License
959 stars 35 forks source link

Deprecation message and recommends to use `typia` instead #137

Closed samchon closed 1 year ago

samchon commented 1 year ago

136

I sent a PR to adding deprecation message.

If someone knows the way to contact with @woutervh-, @WouterVanheeswijk-TomTom, or another maintainer who can merge PR, can you tell him (or them) to review it please?


typescript-is has stopped maintanance for 2 years. In the meantime, typescript has been updated serval times, even v5 major update, and typescript-is has been damanged by those updates. The maintainer @woutervh- is inactive since 2022, so it seems difficult to expect typescript-is to be waken up.

By the way, I've made a competitive library named typia, which has similar validation functions like typescript-is, and it also based on transformation with TypeScript compiler API. As typia supports latest TypeScript version, I think that it would better to add deprecation notice on README, and guide typescript-is users to use typia instead.

// RUNTIME VALIDATORS
export function is<T>(input: unknown): input is T; // returns boolean
export function assert<T>(input: unknown): T; // throws TypeGuardError
export function validate<T>(input: unknown): IValidation<T>; // detailed
export const customValidators: CustomValidatorMap; // for customization

// JSON FUNCTIONS
export namespace json {
    export function application<T>(): IJsonApplication; // JSON schema
    export function assertParse<T>(input: string): T; // type safe parser
    export function assertStringify<T>(input: T): string; // safe and faster
}

// PROTOCOL BUFFER
export namespace protobuf {
    export function message<T>(): string; // Protocol Buffer message
    export function assertDecode<T>(buffer: Buffer): T; // safe decoder
    export function assertEncode<T>(input: T): Uint8Array; // safe encoder
}

// RANDOM GENERATOR
export function random<T>(g?: Partial<IRandomGenerator>): T;

For reference, typia guarantees its safety through 900,000 LOC test codes, and its agenda is to "support every TypeScript types". Therefore, all the chronic bugs of typescript-is that die in union types or complex recursive types have been completely resolved. Furthermore, its performance is faster than any other competitive libraries, and stabilities are superior than any others, too.

Assert Function Benchmark

Measured on Intel i5-1135g7, Surface Pro 8

Components typia TypeBox ajv io-ts zod C.V.
Easy to use
Object (simple)
Object (hierarchical)
Object (recursive)
Object (union, implicit)
Object (union, explicit)
Object (additional tags)
Object (template literal types)
Object (dynamic properties)
Array (rest tuple)
Array (hierarchical)
Array (recursive)
Array (recursive, union)
Array (R+U, implicit)
Array (repeated)
Array (repeated, union)
Ultimate Union Type

p.s) I'd used typescript-is in NestJS, instead of using class-validator, because typescript-is is much convenient and reasonable. I'd tried to make a NestJS decorator library using typescript-is to replace the class-validator, but unfortunately, typescript-is stopped maintanance before completion.

  • nestia: planned to use typescript-is, but currently using typia

Instead, I've made my library typia to support same features of typescript-is. For reference, previous name of typia was typescript-json, and it really supported only JSON related features like JSON schema generation and performance tuning of JSON serialization. Anyway, during the development of typescript-is features in typia, despite core logics of typia are different with typescript-is, typescript-is was a nice repository for studying.

Even though @woutervh- has stopped maintaning, I personally respect and appreciate him as a pioneer. Until typescript-is being broken by break changes of typescript updates, it was really great helpful library for me. Thanks for his hard works, and I will continue the transform-based validator.

woutervh- commented 1 year ago

Thank you. I'm glad the idea of generating type guards at compile time is still relevant. What started out as a curious hobby project turned into something more popular than I could have imagined. I simply don't have the time to maintain it, but I will gladly point the users to typia.

samchon commented 1 year ago

Thanks for acceptance.