# ts-morph: 7.0 out of 10

A strong pick. 6th of 9 in [JavaScript parsers and codemods](https://elestia.ai/opensource/parsers/index.md).

ts-morph wraps the TypeScript compiler API so you can read, analyse and rewrite TypeScript and JavaScript with full type and symbol information. For type-aware refactors it is still the best pick, but one maintainer carries it and it runs on the TypeScript 6 compiler API. Support for the Go-based TypeScript 7 is still being built, so treat that as a real risk.

**Best for:** Developers writing type-aware TypeScript refactors, code generators or analysis tools that need symbols, references and types, not just syntax.

## Scores

- **Overall: 7.0** (likely 5.9 to 8.1)
  - Claude Opus 5.5 (6.5): For refactors and analysis that need types and symbols, it is the clear pick, and growth is above the median. TypeScript 7 support is still unshipped and depends on a fork that one maintainer is building, which keeps the score down. Purely syntactic codemods are better served by jscodeshift/Recast or ast-grep. If the native backend ships cleanly, it would rise to a strong 7–8.
  - GPT-6.2 Sol (7.5): Choose ts-morph when a transform needs to know which declaration a reference points to or what type an expression has. For simple structural rewrites, ast-grep is a better starting point. How soon ts-morph ships stable TypeScript 7 support is the biggest uncertainty for a new long-lived tool.
- **Needed by many: 4.1** (likely 3.1 to 5.3)
  - Claude Opus 5.5 (4.0): Few developers write codemods or analysis tools themselves, and ts-morph targets the TypeScript-aware part of that job. It also parses JavaScript, but its value is type information in TypeScript projects. That makes it a clear but sizeable niche.
  - GPT-6.2 Sol (4.2): TypeScript is common, and ts-morph applies across frameworks to JavaScript and TypeScript tooling. Direct use is concentrated among developers writing migrations, generators, and static analysis tools. The survey measures language use, so the share of developers who need to write those tools is uncertain.
- **Helps a lot: 7.9** (likely 6.8 to 8.8)
  - Claude Opus 5.5 (7.5): No peer in the bundle gives type-aware navigation and manipulation with an ergonomic, well-typed API and solid documentation. The limits are speed and memory on large projects, weaker preservation of formatting than recast, and no runner for codemods in parallel. Support for TypeScript 7 is not shipped yet.
  - GPT-6.2 Sol (8.2): Version 28 combines compiler diagnostics, cross-file reference lookup, and source edits in a documented, typed API. Edits reparse files, and users report that large transformations can be slow. The examples give coding agents concrete API patterns to follow, though current evidence on how often agents generate correct transforms is limited.
- **Holds up over time: 5.5** (likely 3.9 to 7.0)
  - Claude Opus 5.5 (5.0): Activity is low: 18 commits and one major release in the last year, with 275 open issues. Its future depends on TypeScript 7 support. The maintainer reports a working native backend that is faster than ts-morph on TS 6, but it needs a TypeScript fork. The TypeScript team says it does not want to break ts-morph, which helps, but the migration is still a big unshipped change that rests on one person.
  - GPT-6.2 Sol (5.9): The project made 18 commits and one release in the past year, and several pull requests have waited years. Releases are centered on the repository owner, and funding for ongoing maintenance is unclear. The owner reports a working native backend in development, but the TypeScript 7 transition leaves release timing and upgrade effort uncertain.
- **Used widely: 5.7** (likely 4.6 to 6.8)
  - Claude Opus 5.5 (5.5): Downloads rose from 26M to 174M per 4 weeks, a ratio of about 6.7, well above the 4.1 median. Much of that likely comes from tools that bundle it, such as the shadcn CLI run through npx, rather than direct choices. About 20.9k dependent repositories and 2.5k packages point to direct use in the tens of thousands. That is far below Babel or Recast but above Meriyah and ast-grep.
  - GPT-6.2 Sol (5.8): Tracked use is in the tens of thousands of repositories, behind Recast and jscodeshift. Downloads rose 6.68× year over year against the 4.1× catalog median, suggesting a gain in share. Automated and transitive installs blur how many projects choose ts-morph directly, and public discussion is sparse.
- **Vouched for: 6.5** (likely 5.4 to 7.6)
  - Claude Opus 5.5 (6.0): Well-known tools build on it, such as the shadcn CLI and the Codemod.com platform. A TypeScript team member has said publicly that they value it. Independent guides name it the default for type-aware transforms. Survey data and independent benchmarks are missing.
  - GPT-6.2 Sol (7.0): MikroORM offers a metadata provider built on ts-morph, and Grafana and NestJS list version 28 in their development tooling. Microsoft used it for the TypeScript compiler's module migration in 2023. An independent comparison backs its value for type-aware edits, while current benchmarks and satisfaction data remain sparse.
- **Safe: 6.5** (likely 5.4 to 7.7)
  - Claude Opus 5.5 (7.0): It has no known advisories, only two direct dependencies and an MIT licence. The OpenSSF Scorecard is weak at 3.6, with no branch protection, pinned dependencies or security policy. Releases come from a single maintainer. It is usually a dev-time tool, which limits the exposure in production.
  - GPT-6.2 Sol (6.0): The package is MIT-licensed, has two direct dependencies, and ships with verified build provenance from GitHub Actions. OSV lists zero advisories against ts-morph itself, while the released dependency range pulls in minimatch versions covered by a moderate denial-of-service advisory. Scorecard flags weak code review, branch protection, and workflow controls. Practical exposure to the advisory depends on the glob inputs and matching options.

## Good

- Gives full type-checker access: you can resolve symbols, find references and rename across a whole project.
- Its high-level, well-typed API with structures and code writers is much easier than the raw TypeScript compiler API.
- It has few direct dependencies, no known advisories and an MIT licence.
- It is widely embedded in tooling, such as the shadcn CLI's import transformers and the Codemod.com platform.

## Bad

- It depends on the TypeScript 6 compiler API, and support for the Go-based TypeScript 7 still relies on a fork the maintainer has not finished.
- Loading a large project into the language service is slow and uses a lot of memory, so big batch codemods can take minutes.
- It preserves formatting less well than recast or jscodeshift, so diffs can be noisy.
- One maintainer does most of the work, and the repository shipped one release and 18 commits in the last year.

## The numbers

- Downloads, 4 weeks: 174M
- In a year: ×6.7
- GitHub stars: 6.2k
- Commits, 12 months: 18
- Last npm release: Apr 2026
- Advisories, 24 months: 0
- Licence: MIT
- GitHub: https://github.com/dsherret/ts-morph
- npm: https://www.npmjs.com/package/ts-morph

Scores run from 0 to 10 and are the mean of the scores of AI reviewers (Claude Opus 5.5, GPT-6.2 Sol), made on 22 November 2026 from GitHub, npm, OSV, OpenSSF Scorecard, ecosyste.ms, Hacker News and Bluesky data and a web search. The ecosyste.ms count of repositories that use a project is far too low for projects that grew in the last few years, and some reviews quote it. Overall is the reviewers' own judgement for a new project today, not an average of the parts. An AI wrote them and can be wrong.
