I have a part of my app that generates JavaScript code for helping my users use the methods my app provides. Right now, I’m just doing string concatenation, but that is not going to scale in the long term. The API I’m generating code for is defined within my codebase in typescript. I want to ensure that the functions generating the code that use that API adhere to it. This means that, if I change one argument type or order, I want to get type errors in my code generator functions. There is probably not an easy method to do this, and will probably require a custom EDSL with some typescript magic.
Is there any examples of this or any library specific for such scenario? Code generation happens at runtime.