Packages

ts-morph

28.0.0 · 12 Apr 2026MIT46.3M / weekRepositoryHomepagenpmAtom feed

Your version

28.0.0

Latestmajor12 Apr 2026Where it was published

In short

2 breaking1 new1 fixed

  • Breaking

    BREAKING: TypeScript 6.0

  • Breaking

    Note there are some breaking changes due to TypeScript 6.0.

Release note

What's Changed

  • Breaking

    BREAKING: TypeScript 6.0

  • Standalone printStructure function

  • InvalidOperationError in addTypeArgument

Note there are some breaking changes due to TypeScript 6.0. Read more here: devblogs.microsoft.com/typescript/announcing-ty…

As part of this release, structures can now be printed to a string using the printStructure function.

import { printStructure, StructureKind } from "ts-morph";

const code = printStructure({
  kind: StructureKind.Class,
  name: "MyClass",
  isExported: true,
  properties: [{ name: "myProp", type: "string" }],
  methods: [{
    name: "myMethod",
    parameters: [{ name: "param", type: "number" }],
    returnType: "void",
  }],
});
console.log(code);

Outputs:

export class MyClass {
  myProp: string;

  myMethod(param: number): void {
  }
}

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.