3 ms·
The typing is interesting as I have been leveraging Typescript as an IDL for code generation between Go backend and TypeScript frontend. (GraphQL and gRPC were
by mmgutz 4y ago
The typing is interesting as I have been leveraging Typescript as an IDL for code generation between Go backend and TypeScript frontend. (GraphQL and gRPC were not expressive enough to define services, DTOs and JSON schema forms). Parsing Typescript's AST is simple. My guess is they generate code based on statically analyzable type arguments. I'm eager to try their approach. I am currently parsing jsdoc comments and tags for metadata which doesn't benefit from Typescript's checker.
jooq is awesome. I was using that with DropWizard way back when. Now I'm just Go.
- primering 4y agoWe generate byte-code from the TypeScript AST, embed that into the emitted JavaScript, and execute them on-demand in a virtual machine during runtime. The result is a type-object which contains the computed type of a TypeScript type expression which can then be used for various use-cases. We use them for ORM, validation, serialisation, RPC, HTTP Router, etc. You can learn more on how it works here https://deepkit.io/blog/introducing-deepkit-framework https://deepkit.io/blog/introducing-deepkit-framework and in very detail in the TypeScript Bytecode proposal: https://github.com/microsoft/TypeScript/issues/47658 https://github.com/microsoft/TypeScript/issues/47658. Soon in a new doc/ebook it is explained in great detail how it works and the API of it can be utilised to build for example your own libraries/functionalities on top of it.
- VyperCard 4y agoIt’s a great read. Thanks.