Packages

ts-morph

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

Your version

4.0.0

major3 Sep 2019Where it was published

4.3.3 is the newest release of 4.x.

In short

5 breaking5 new1 faster2 fixed4 internal

  • Breaking

    DiagnosticMessageChain#getNext() now returns an array to match TS 3.6.

  • Breaking

    SourceFile#getReferencedFiles() is now getPathReferenceDirectives().

  • Breaking

    CodeBlockWriter#indentBlock is now indent. withHangingIndentation is now hangingIndent. withHangingIndentationUnlessBlock is now hangingIndentUnlessBlock.

  • Breaking

    DirectoryEmitResult#getEmitSkipped() was removed. Check the output file paths and skipped file paths instead as that's more accurate.

  • Breaking

    CompilerExtendedComment is now called CompilerCommentNode.

Release note

The section about ts-morph of a note shared by several packages.

Bug Fixes

  • JSDoc.getInnerText would sometimes get the wrong text if the first line content contained an asterisk.

  • Fix getParent() for TS 3.6.

Features

  • Calling Project#createSourceFile with an existing file name now suggests to add the overwrite option.

  • Add past parent as second parameter to getParentWhile

  • Add Type#getPropertyOrThrow

  • Add SourceFile#getReferencedSourceFiles(), #getNodesReferencingOtherSourceFiles(), and #getLiteralsReferencingOtherSourceFiles().

  • Upgrade to code-block-writer 10.0.0.

Performance Improvements

  • Bundle scripts

Breaking changes

  • Breaking

    SourceFile#getReferencedFiles() is now getPathReferenceDirectives().

This was done to prevent confusion with upcoming methods in #680. The name was chosen because it is similar to the methods getTypeReferenceDirectives() and getLibReferenceDirectives().

  • Breaking

    CodeBlockWriter#indentBlock is now indent. withHangingIndentation is now hangingIndent. withHangingIndentationUnlessBlock is now hangingIndentUnlessBlock.

  • Breaking

    DiagnosticMessageChain#getNext() now returns an array to match TS 3.6.

  • Breaking

    DirectoryEmitResult#getEmitSkipped() was removed. Check the output file paths and skipped file paths instead as that's more accurate.

  • Breaking

    CompilerExtendedComment is now called CompilerCommentNode.

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.