#generate code out of Typescript types

9 messages · Page 1 of 1 (latest)

safe hatch
#

hey, i want to write a script that takes a typescript type/interface and generate an equivalent representation for the same model but in another description language.
not sure where to start.

pastel barn
#

the principle is called transpilation

#

tho I don't know of an good tool to do that

#

also, what languages do you have in mind?

#

try being more explicit

safe hatch
#

so my target will be a language called KQL- Kusto Query Language , my goal is to take a typescript interface, and generate a code that builds a command to create a table with the same data model in that language. and this is a thing that i do manually frequently and i am looking into a way to automate that.

pastel barn
#

well, if you are creating your own language, you'll need to write your own code generator

#

tho if you need to parse actual code, I think ts-morph has you covered

#

or the tsc compiler