Our great sponsors
-
MakeTypes
Make TypeScript types and proxy objects from example JSON objects. Can use proxy objects to dynamically type check JSON at runtime.
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
Been doing a little bit of digging into how to do code generation with typescript, but I'm struggling to find resources on how to actually use the ts factory API without going directly into the source code. So far, this has been the most useful excerpt I've found: https://github.com/microsoft/TypeScript/wiki/Using-the-Compiler-API#creating-and-printing-a-typescript-ast
Found a couple libraries like MakeTypes, but they are going in the wrong direction for my needs. My object describes how to make the typing information, but is not an implementation of that typing information.
You can take a look at TypescriptToLua which transforms the TS AST into Lua code using the compiler API, however I think you're barking up the wrong tree. The TS compiler works on *it's own\* AST generated from parsed Typescript. You can see how they implement your own type here. What you have some structured data and want to turn it into a type definition. That's just some loops you write yourself over data you've hopefully structured in a sane way. Turn it into a string, write it to a file with the extension `.d.ts`. No libraries needed.