Packages

ts-morph

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

Your version

6.0.0

major7 Dec 2019Where it was published

6.0.3 is the newest release of 6.x.

In short

13 breaking20 new1 faster3 fixed2 internal

  • Breaking

    JSDoc#setComment(...) and #getComment(...) are now setDescription(...) and getDescription(). They also work according to #764.

  • Breaking

    StructureTypeGuards is now Structure.

  • Breaking

    PropertyDeclarationDeclaration and PropertyDeclarationStructure now can have a declare keyword (new in TS 3.7).

  • Breaking

    JS docs will be written as a single line unless multi-line or starting with a newline. Additionally, getting a JS doc structure will have a newline at the start if the JS doc description is one line, but the JS doc is multi-line.

  • Breaking

    ProjectOptions#useVirtualFileSystem is now useInMemoryFileSystem. This is a more accurate name.

  • Breaking

    Creating a Project with useInMemoryFileSystem: true will now load in the lib files into the node_modules/typescript/lib folder.

  • Breaking

    Due to the fix for #702, when using Project#addSourceFileAtPaths directories that do not have an ancestor directory with a source file included in the results will no longer be added to the project. If you want to ensure that a directory and all its subfolders are added, use Project#addDirectoryAtPath(path, { recursive: true }).

  • Breaking

    FileSystemHost#glob is now asynchronous and #globSync was added.

Release note

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

Bug Fixes

  • common: Fix running in the browser.

  • Fix bug where Project#getRootDirectories() might return a directory not in the project.

  • Getting symbol exports by name should call ts.escapeLeadingUnderscores on the name.

Features

  • Prefer writing single line JS docs. Add JSDoc#isMultiLine().

  • bootstrap: Rename addSourceFiles -> addSourceFilesByPaths to match ts-morph.

  • Manipulation error now throws a custom error object.

  • Directory#getSourceFiles now accepts globs.

  • Creating an in-memory file system now loads the lib files by default.

  • The virtual file system host will have lib files loaded by default.

  • Move TypeGuards to be static members of Node (methods still exist on TypeGuards, but will be removed later). (9b1e659), closes #728

  • Add Directory#clear().

  • Add QuestionDotTokenableNode.

  • SourceFile#applyTextChanges now accepts objects of type ts.TextChange.

  • Add getTypeExpressionOrThrow() to JSDocReturnTag and JSDocPropertyLikeTag

  • Add JSDoc#insertTags and similar methods.

  • Add JSDocTag#remove().

  • Add JSDocTag#setTagName

  • Add JSDocTagStructure.

  • Expose InMemoryFileSystemHost.

  • Rename useVirtualFileSystem to useInMemoryFileSystem

  • Support declare keyword on class properties.

  • Upgrade to code-block-writer 10.1.0.

  • Wrap BigIntLiteral.

performance

  • Fix Project#addSourceFileAtPaths being needlessly slow in some scenarios.

Breaking changes

  • Breaking

    JSDoc#setComment(...) and #getComment(...) are now setDescription(...) and getDescription(). They also work according to #764.

  • Breaking

    StructureTypeGuards is now Structure.

  • Breaking

    PropertyDeclarationDeclaration and PropertyDeclarationStructure now can have a declare keyword (new in TS 3.7).

  • Breaking

    JS docs will be written as a single line unless multi-line or starting with a newline. Additionally, getting a JS doc structure will have a newline at the start if the JS doc description is one line, but the JS doc is multi-line.

  • Breaking

    ProjectOptions#useVirtualFileSystem is now useInMemoryFileSystem. This is a more accurate name.

  • Breaking

    Creating a Project with useInMemoryFileSystem: true will now load in the lib files into the node_modules/typescript/lib folder.

  • Breaking

    Due to the fix for #702, when using Project#addSourceFileAtPaths directories that do not have an ancestor directory with a source file included in the results will no longer be added to the project. If you want to ensure that a directory and all its subfolders are added, use Project#addDirectoryAtPath(path, { recursive: true }).

  • Breaking

    FileSystemHost#glob is now asynchronous and #globSync was added.

  • Breaking

    Renamed Directory/Project#addExistingSourceFile -> addSourceFileAtPath

  • Breaking

    Renamed Directory/Project#addExistingSourceFileIfExists -> addSourceFileAtPathIfExists

  • Breaking

    Renamed Directory/Project#addExistingSourceFiles -> addSourceFilesAtPaths

  • Breaking

    Renamed Directory/Project#addExistingDirectory -> addDirectoryAtPath

  • Breaking

    Renamed Directory/Project#addExistingDirectoryIfExists -> addDirectoryAtPathIfExists

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.