-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add typia #1023
feat: add typia #1023
Conversation
Features/typia
More simple parseSafe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed to test program in my local.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As other validation libraries do not allow undefined value assignment on superfluous peoperty, typia
also blocked it by supporting extra options.
interface Member {
id: string;
name: string;
age?: number;
}
const member: Member = {
id: "some-id",
name: "some-name",
age: undefined
};
// possible in typia
// however, not possible in other validators
// therefore, added an extra option blocking the undefined value to ensure same condition
@samchon The tests pass! 🎉 But now that I understand typia more, I am a bit hesitant to merge this, as I am not 100% confident this package goes with the theme of the rest of the packages here. The theme was defining types as code, and then allowing TypeScript to infer the types. However, I do like the typia approach, and especially, because it is so much faster. I am just wondering if perhaps we need an entirely new category of validators now? @hoeck Thoughts? |
Well, this repository already had accepted ts-runtime-checks which requires Also, most validator libraries listed on here repo be broken just by using a little bit complicate type like recursive or union types. For example, above Such imperfection is the reason why I have developed https://github.com/samchon/typia/tree/master/test/structures |
@moltar Yeah, instead of using function composition, it directly parses interfaces at compile time, similar to the runtime type reflection that deepkit does. Using that info, it generates code similar to e.g. spectypes. So for me, typia fits the runtype category, event though it is much more meta than more conventional (zod, valita) approaches: ✔️ the type is only written out once There are even more unconventional approaches to runtypes out there, e.g. arktype that mixes function composition and template literal types. Having them all in a single basic benchmark is IMHO a really useful resource and to me would be more important than strict inclusion criteria. It helps comparing all the different approaches, is a good showcase for the TS ecosystem and helps developers new to runtypes to maybe pick a good library that fits their use case.
|
@samchon having more benchmark cases would be great but on the other hand implementing them for all libraries and presenting (weighing?) the resulting data in a useful way would be a lot of work. I'd love to do it but my time is quite limited. |
Related issues:
typia
#898@Typia
#1019I can't see benchmark result because I am using Windows PC and this repo be broken on the Windows PC.
Hope to be the fastest.