You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discussion: One Typescript Transformer to run them All
Hello, I been reading a bit after discovering the typescript-needs-types repo and Looks like the TS team will never emit type data to be used at runtime.
There are currently 2 approaches to solve validation which i suppose is the main use case.
1 - Libraries that that declare an schema and then infer a type from that schema. i.e: zod, valibot, etc...
2 - Libraries that use Typescript Transformers to read the AST and either modify the js output or emit type metadata.
As the TS team would never emit types metadata Think we could identify the libraries that use Typescript Transformers and create a single package that suits every current existing library requirements and use that single one instead duplicated efforts. (Just for the part that parses the AST and eemits code or metadata)
I've personally have investigated two libraries that uses typescript transformers, Typia and Deepkit (from what I can see these two are that mayor players using typescript transformers).
These two as well have different approaches. Typia emmits custom validation functions while Deepkit emits bytecode representing the type metadata.
Maybe we could create a well documented package that boths emits metadata and use a visitor pattern or similar so can emit custom code when traversing the AST, this would cover both typia and deepkit requirement and would be the base for any other project trying to achieve something similar.
We would nne to chat with @samchom and @marcj and check if they are up to the task. I'm not that expert on using the AST but happy to collaborate on what i can 👍
Note I've opened this same Issue in the involved repos:
Discussion: One Typescript Transformer to run them All
Hello, I been reading a bit after discovering the typescript-needs-types repo and Looks like the TS team will never emit type data to be used at runtime.
There are currently 2 approaches to solve validation which i suppose is the main use case.
1 - Libraries that that declare an schema and then infer a type from that schema. i.e: zod, valibot, etc...
2 - Libraries that use Typescript Transformers to read the AST and either modify the js output or emit type metadata.
As the TS team would never emit types metadata Think we could identify the libraries that use Typescript Transformers and create a single package that suits every current existing library requirements and use that single one instead duplicated efforts. (Just for the part that parses the AST and eemits code or metadata)
I've personally have investigated two libraries that uses typescript transformers, Typia and Deepkit (from what I can see these two are that mayor players using typescript transformers).
These two as well have different approaches. Typia emmits custom validation functions while Deepkit emits bytecode representing the type metadata.
Maybe we could create a well documented package that boths emits metadata and use a visitor pattern or similar so can emit custom code when traversing the AST, this would cover both typia and deepkit requirement and would be the base for any other project trying to achieve something similar.
We would nne to chat with @samchom and @marcj and check if they are up to the task. I'm not that expert on using the AST but happy to collaborate on what i can 👍
Note I've opened this same Issue in the involved repos:
The text was updated successfully, but these errors were encountered: