ts-morph
A strong pick. 6th of 9 JavaScript parsers and codemods.
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
Overall7.0
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 6.5, likely 5.5 to 7.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.
- github.com/dsherret/ts-morph/issues/1621: TS 7 path in progress, not released
- pkgpulse.com/guides/recast-vs-jscodeshift-vs-ts-morph-codemods-code-2026: Best for type-aware work, weaker for batch syntax codemods
- npm downloads ratio vs medianDownloadsRatio: 6.7 vs 4.1 median
GPT-6.2 Sol: 7.5, likely 6.3 to 8.6
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.
- ts-morph.com/navigation/finding-references: Shows how to find symbol references and locate them across source files.
- graph-sitter.dev/docs/blog/codemod-frameworks: Compares ts-morph's type-aware API with ast-grep's pattern-based rewrites.
- github.com/dsherret/ts-morph/issues/1621: Tracks the native compiler transition.
Needed by many4.1
How many developers need a tool for this job?
Claude Opus 5.5: 4.0, likely 3.0 to 5.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.
- category.job: Parsing and changing code as a tree is a tooling niche
- pkgpulse.com/guides/recast-vs-jscodeshift-vs-ts-morph-codemods-code-2026: Positioned for TypeScript-aware transformations
GPT-6.2 Sol: 4.2, likely 3.1 to 5.5
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.
- 2025.stateofjs.com/en-US/usage/#js_ts_balance: About 40% of respondents to the language balance question wrote exclusively in TypeScript.
- github.com/dsherret/ts-morph: Documents JavaScript and TypeScript analysis and source editing.
Helps a lot7.9
How well does it do the job for those who need it?
Claude Opus 5.5: 7.5, likely 6.5 to 8.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.
- pkgpulse.com/guides/recast-vs-jscodeshift-vs-ts-morph-codemods-code-2026: Type-aware strengths; slower, noisier diffs, no CLI runner
- dev.to/dev_encyclopedia/why-your-typescript-7-upgrade-broke-eslint-ts-jest-and-ts-morph-385k: Advises keeping TS 6.x for ts-morph; TS 7 API not stable until 7.1
- npm hasTypes: Ships its own types
GPT-6.2 Sol: 8.2, likely 7.0 to 9.1
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.
- ts-morph.com/manipulation/renaming: Documents project-wide renames and how to handle aliases and shorthand properties.
- ts-morph.com/setup/diagnostics: Shows how to collect and format compiler diagnostics with source context.
- ts-morph.com/manipulation/performance: Explains reparsing costs and how batching reduces them.
- github.com/dsherret/ts-morph/issues/1433: A user reports slow post-build transformations.
- codemod.com/blog/ts-morph-support: Reports early experiments with AI-generated codemods.
Holds up over time5.5
Will it still be a good choice in two years?
Claude Opus 5.5: 5.0, likely 3.5 to 6.5
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.
- github commitsLastYear / releasesLastYear: 18 commits, 1 release in the last year
- github.com/dsherret/ts-morph/issues/1621: Maintainer building a Go/Wasm backend via a TS fork; reports progress Sep 2026
- scorecard Maintained: Maintained check scores 2
- devblogs.microsoft.com/typescript/announcing-typescript-7-0: TypeScript 7 went GA in July 2026, so the ecosystem is moving
GPT-6.2 Sol: 5.9, likely 4.3 to 7.5
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.
- github.commitsLastYear, github.releasesLastYear, github.pushedAt: 18 commits, one release, and a recent push.
- github.com/dsherret/ts-morph/releases: The owner publishes releases, and version 28 flags breaking TypeScript 6 changes.
- github.com/dsherret/ts-morph/pulls: Several older changes are still awaiting merge.
- github.com/dsherret/ts-morph/issues/1621: The owner reports progress on a native backend.
- devblogs.microsoft.com/typescript/announcing-typescript-7-1-beta: Microsoft describes the new programmatic compiler API.
Used widely5.7
How many use it, and is that growing?
Claude Opus 5.5: 5.5, likely 4.5 to 6.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.
- npm downloadsLast4Weeks / downloadsSame4WeeksYearAgo: 173.7M vs 26.0M, ratio ~6.7
- dependents: 20,857 repos, 2,484 packages
- deepwiki.com/shadcn-ui/ui/4.4-dependency-resolution-system: shadcn CLI uses ts-morph for import transforms, inflating installs
- bluesky posts: Only 2 posts; low social attention
GPT-6.2 Sol: 5.8, likely 4.7 to 7.0
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.
- npm.downloadsLast4Weeks, npm.downloadsSame4WeeksYearAgo, medianDownloadsRatio: 173.7 million versus 26.0 million downloads over four weeks.
- dependents.repos, dependents.packages, peers: 20,857 tracked repositories and 2,484 npm dependents. Recast and jscodeshift have more tracked repositories.
- github.stars, bluesky.posts, hackerNews.stories: 6,233 stars, two Bluesky posts, and zero matching Hacker News stories.
Vouched for6.5
Who stands behind it being good?
Claude Opus 5.5: 6.0, likely 5.0 to 7.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.
- codemod-3m5c821mp-codemod.vercel.app/blog/ts-morph-support: Codemod platform added ts-morph support
- github.com/dsherret/ts-morph/issues/1621: TypeScript team member says blocking ts-morph is an anti-goal
- pkgpulse.com/guides/recast-vs-jscodeshift-vs-ts-morph-codemods-code-2026: Independent guide recommends it for TS-aware work
GPT-6.2 Sol: 7.0, likely 5.8 to 8.1
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.
- mikro-orm.io/docs/metadata-providers: Documents an optional provider that reads entity types with ts-morph.
- github.com/grafana/grafana/blob/main/package.json: Grafana lists version 28 as a development dependency.
- github.com/nestjs/nest/blob/master/package.json: NestJS pins version 28 in its development dependencies.
- devblogs.microsoft.com/typescript/typescripts-migration-to-modules: The TypeScript team describes using ts-morph in its own migration.
- graph-sitter.dev/docs/blog/codemod-frameworks: A competing tool's comparison credits ts-morph's type information and project-wide analysis.
Safe6.5
How safe is it to depend on?
Claude Opus 5.5: 7.0, likely 6.0 to 8.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.
- advisories total: 0 advisories
- npm dependencies: 2 direct dependencies
- scorecard score: 3.6; Branch-Protection, Security-Policy, Pinned-Dependencies at 0
- github license: MIT
GPT-6.2 Sol: 6.0, likely 4.8 to 7.3
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.
- npm.license, npm.dependencies, advisories.total: MIT licence, two direct dependencies, and zero direct OSV advisories.
- scorecard: 3.6 out of 10, with weak review and zero scores for branch protection, token permissions, dependency pinning, and security policy.
- deps.dev/npm/ts-morph: Verifies version 28's release provenance and flags the transitive advisory.
- raw.githubusercontent.com/dsherret/ts-morph/28.0.0/packages/common/package.json: The released common package requires minimatch 10.x.
- github.com/advisories/GHSA-g3hv-75wg-m249: The reviewed advisory identifies 11.0.1 as the patched version.
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
- npm downloads, 4 weeks
- 174M ×6.7 in a year
- GitHub stars
- 6.2k
- Commits, 12 months
- 18
- npm version
- 28.0.0 Apr 2026
- Versions, 12 months
- 1
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- 3.6 out of 10, Nov 2026
- Licence
- MIT
Read on 21 November 2026 from GitHub (dsherret/ts-morph), npm (ts-morph), OSV and the OpenSSF Scorecard.
JavaScript parsers and codemods
- 8.0Babel parser
- 7.8Oxc parser
- 7.5ast-grep
- 7.1Acorn
- 7.1Recast
- 7.0ts-morph
- 6.4jscodeshift
- 6.3Meriyah
- 2.4Esprima