Repolode
dsherret

dsherret/ts-morph

A TypeScript wrapper around the TypeScript Compiler API for analyzing and programmatically changing TypeScript and JavaScript code.

Stars
6,222
Forks
250
Open issues
301
Last commit
last month

What is it?

ts-morph provides a higher-level interface over the TypeScript Compiler API, making it easier to navigate syntax trees, inspect types and symbols, and manipulate source code programmatically. It is aimed at tools that generate, refactor, or analyze TypeScript and JavaScript projects.

The repository is a monorepo. The main ts-morph package is the Compiler API wrapper, and @ts-morph/bootstrap is a separate library for setting up the Compiler API quickly.

The project is written in TypeScript and is distributed under the MIT license. It also links to a TypeScript AST Viewer website for exploring syntax trees.

Key features

  • 01Navigate and inspect TypeScript and JavaScript syntax trees with a simpler API.
  • 02Read types and symbols from source files.
  • 03Make programmatic code changes such as adding or modifying declarations.
  • 04Provide a separate bootstrap package for quick Compiler API setup.

Use cases

  • Building code generators that emit TypeScript files.
  • Writing refactoring or migration scripts for large codebases.
  • Running static analysis checks on TypeScript projects.

Topics

FAQ

What is ts-morph?
A TypeScript wrapper around the TypeScript Compiler API for analyzing and programmatically changing TypeScript and JavaScript code. ts-morph provides a higher-level interface over the TypeScript Compiler API, making it easier to navigate syntax trees, inspect types and symbols, and manipulate source code programmatically. It is aimed at tools that generate, refactor, or analyze TypeScript and JavaScript projects.
Is ts-morph free to use? What license does it have?
ts-morph is open source under the MIT license. Check the license terms before using it in commercial products.
Is ts-morph still maintained?
Updated within 6 months. The last commit to ts-morph was on Sep 29, 2026.
What can I use ts-morph for?
Building code generators that emit TypeScript files. Writing refactoring or migration scripts for large codebases. Running static analysis checks on TypeScript projects.
Where can I get ts-morph?
The source code and installation instructions are on GitHub: https://github.com/dsherret/ts-morph

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects