I'm using the built-in parser to generate the AST from source code:
const ts = require('typescript')
//...
const ast = ts.createSourceFile(filename, fs.readFileSync(filename).toString(), ts.ScriptTarget.ES6, true)
Given an arbitrary node in the tree, how do I generate the typescript from the node?