Renamed to Typia
https://github.com/samchon/typia
Hello, I'm developer of typescript-json typia.
In nowadays, I've renamed typescript...
For further actions, you may consider blocking this person and/or reporting abuse
This looks great!
Does the
is
method support TS interfaces or just classes that exist during runtime? I ask because I played around with type guards for interfaces using code generation to create runtime representations of interfaces, and I wonder if that's somethingtypia
does.I worked with TS in the past and now I work with Java and protocol buffers, where I also did code generation based on generated
Message
Java subclasses. Interesting to see what protobuf looks like in TS.Yes, this is a transformer library generating validation script by analyzing TypeScript type. If you're wondering how
typia
generates protobuf message, reference test automation code.I know automatically generated message by current
typia
is so ugly yet, but it would be reasonable. Also, as you are interested in protobuf, you may understand howtypia
implemented non-protobuf supported type through detour expression.github.com/samchon/typia/tree/feat...
In another community, someone asked me the reason why such performance gap.
It's my answer and I also paste it here
dev.to
"15,000x faster" is just a benchmark program result and such different is not weird considering principle of v8 optimization. It is enough reasonable and descriptable.
typia
performs AOT compilation through TypeScript APIajv
andtypebox
performs JIT compilation through eval() functionclass-validator
abuses for in statement and dynamic [key, value] allocation in every stepV8 engine optimizes object construction by converting to a hidden class and avoid hash map construction for taking advantages of static class definition. However, if
for in
statement or dynamic key allocation being used, v8 cannot optimize the object.The secret of extremely slow validation speed of
class-validator
is on there.class-validator
utilizes the un-optimizable in every process.For reference,
ajv
andtypebox
are using JIT compilation, generating optimized code in runtime througheval()
function (ornew Function(string)
statement). In v8 engine, priority of optimization is the lowest and it is the principle reaon whytypia
is faster than suchajv
andtypebox
libraries.Another reason is how to optimize object accessment. You can see the detailed story about it from below link (this article)
I am proud to be your first comment.
There's too much I don't understand about your post 😅
But I recognize that there is genius here. And
typia
will be very famous 💙🔥great job with this library🎉 will definitely give it a try.
Can it replace the tsc? Very exciting project and I can't wait to try it out.
Well, this is not a project for replacing
tsc
(TypeScript Compiler).Thanks for the interesting material, I use ajv actively, it's definitely worth it
As I've promised, wrote an article introducing how to use
typia
inNestJS
.dev.to/samchon/nestia-boost-up-you...