Docs for how to transpile one language to another using tree-sitter?
I can't seem to find any docs about what I can access through the Node.js API. I would like to convert C++ to TypeScript, as an experiment, and thought I could use the AST produced from tree-sitter for C++, but all it gives me are nodes with a type property, but no function names, variable names, etc..
How can I get access to all that information and traverse the tree? I don't see any examples for this. Thank you!
You need to implement this yourself. You can extract the concrete syntax tree of a C++ code file and generate TypeScript code based on it. there are differences between the two languages, and you'll need to define your own conversion rules.
The upstream docs (https://tree-sitter.github.io/tree-sitter) give the higher-level overview for querying and walking the syntax trees, and the readme + API docs for the node bindings (https://tree-sitter.github.io/node-tree-sitter) should be enough info on what methods are available to you. The rest is on you to implement