Code to run

Example Code

Program output



  1. - Not very useful but shows Scanned API. Taken from TypeScript book
  2. - Using TypeScript transformation API we change all property access expression like "" so when "bar" has the name "accessorToBeRemoved" we leave only "foo". See how the example code changes after run it
  3. - More complex example of using TypeScript Transformation API. See comments in the code for details. Heads up, the example sources changes after run completes.
  4. - Another Transformation API example that will add new nodes, this time putting a name to functions declared without name
  5. - Using TypeScript Compiler API to "write" code by creating a AST from code data-structures. Prints the result out, in this case, a working factorial function, taken from TypeScript Compiler API docs
  6. - Using TypeScript Compiler API To transpile a single file to JavaScript. Tken from TypeScript Compiler API docs
  7. - Using tsquery library to count Identifiers with a certain name
  8. - Ideal for testing or using APIs in memory. Also, a small mostration on how to navegate the AST
  9. - Example using ts-simple-ast rename() tool - will rename randomly almost every identifier found in the input. Very crazy and heuristic - don't try this at home!
  10. - walk the AST and use the checker to serialize class information. Use the type checker to get symbol and type information, while grabbing JSDoc comments for exported classes, their constructors, and respective constructor parameters. Example adapted from TypeScript Compiler API docs
  11. - Using ts-simple-ast and tsquery together :
Fork me on GitHub