title: How can I parse, modify, and regenerate the AST of a TypeScript file (like jscodeshift)?
body: <p>My use case: I'm building a <a href="http://yeoman.io/authoring/file-system.html" rel="noreferrer">Yeoman generator</a>, that modifies TypeScript files; in ways similar to:</p>
  
  <ul>
  <li>Add <code>import</code> statements</li>
  <li>Import components into an AngularJS module</li>
  </ul>
  
  <p>Yeoman recommends using an AST parser for this task:</p>
  
  <blockquote>
    <p>The most reliable way to do so is to parse the file AST (abstract syntax tree) and edit it. </p>
  </blockquote>
  
  <p>Tools like <a href="https://github.com/facebook/jscodeshift" rel="noreferrer">jscodeshift</a> make this fairly straightforward for JavaScript files, but it doesn't appear to support TypeScript. Are there any similar tools to parse and modify the AST of a TypeScript file?</p>