NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1924 most downloaded on npm
TypeScript compiler wrapper for static analysis and code manipulation.
Last release 5 months ago
12 Apr 2026
Ships fairly regularly
a new release about every 3 months
Most releases are documented
notes for 40 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
89 releases · first in 2019
Note there are some breaking changes due to TypeScript 6.0. Read more here: https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/
printStructure function by @dsherret in #1670InvalidOperationError in addTypeArgument by @jfirebaugh in #1663Note there are some breaking changes due to TypeScript 6.0. Read more here: https://devblogs.microsoft.com/typescript/announcing-typescript-6-0/
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 {
}
}Full Changelog: 27.0.2...28.0.0
One column per quarter.
Fixes the npm publish in order to get the fixes in from 27.0.1
Full Changelog: 27.0.1...27.0.2
perf: switch to tinyglobby by @benmccann in #1635
TypeChecker - add getAwaitedType by @JHawk0224 in #1643JSDocImportTag by @dsherret in #1648Full Changelog: 26.0.0...27.0.0
fix: Improve comma appending logic to handle nested template literals correctly by @kingston in #1630
bump TypeScript from 5.7.2 to 5.7.3
fix: switch back to fast-glob for stability #1595
Full Changelog: 24.0.0...25.0.0
perf: remove mkdirp dependency by @benmccann in #1549
Full Changelog: 23.0.0...24.0.0
feat: ts 5.5 by @dsherret in #1545
Now available on JSR for use in Deno: https://jsr.io/@ts-morph/ts-morph
Full Changelog: 22.0.0...23.0.0
feat(BREAKING): upgrade to TypeScript 5.4 by @dsherret in #1516
Node.prototype.forgetDescendants() no longer returns self by @dsherret in #1515Type.prototype.isAssignableTo by @dsherret in #1517TypeChecker.prototype.resolveName by @dsherret in #1518People may have been working around these bugs in the past:
.quote() - should include newline on newline (dsherret/code-block-writer#47).quote() - escape characters were not always being escaped (dsherret/code-block-writer#46)Full Changelog: 21.0.1...22.0.0
Type.prototype.isAssignableTo (#1517) (e8b5727)TypeChecker.prototype.resolveName (#1518) (ca77636)Node.prototype.forgetDescendants() no longer returns self (#1515) (92962aa)People may have been working around these bugs in the past:
.quote() - should include newline in literal (https://github.com/dsherret/code-block-writer/pull/47).quote() - escape characters were not always being escaped (https://github.com/dsherret/code-block-writer/pull/46)<a name="21.0.0"></a>
I forgot to run a code generation script to update some code for the 21.0.0 release and only realized after. This release fixes that and also reduces
I forgot to run a code generation script to update some code for the 21.0.0 release and only realized after. This release fixes that and also reduces the chance of that happening in the future.
For 21.0.0 release notes, see https://github.com/dsherret/ts-morph/releases/tag/21.0.0
Full Changelog: https://github.com/dsherret/ts-morph/compare/21.0.0...21.0.1
feat: ProjectOptions::defaultCompilerOptions by @wojpawlik in https://github.com/dsherret/ts-morph/pull/1460
ProjectOptions::defaultCompilerOptions by @wojpawlik in https://github.com/dsherret/ts-morph/pull/1460getShorthandAssignmentValueSymbol to TypeChecker. add convenience method for getting the value symbol on ShorthandPropertyAssignment. by @kronodeus in https://github.com/dsherret/ts-morph/pull/1456@ts-morph/common file system methods return undefined instead of throwing when not exists (for perf).Full Changelog: https://github.com/dsherret/ts-morph/compare/20.0.0...21.0.0
ProjectOptions::defaultCompilerOptions (#1460) (b5dee3d)getShorthandAssignmentValueSymbol to TypeChecker (#1456) (1d8b382)@ts-morph/common file system methods return undefined instead of throwing when not exists (for perf).<a name="20.0.0"></a>
feat: upgrade to TypeScript 5.2 by @dsherret in https://github.com/dsherret/ts-morph/pull/1450
Full Changelog: https://github.com/dsherret/ts-morph/compare/19.0.0...20.0.0
<a name="19.0.0"></a>
docs: add deno installation method by @scarf005 in https://github.com/dsherret/ts-morph/pull/1411
Type by @odiak in https://github.com/dsherret/ts-morph/pull/1408Type by @giuseppelt in https://github.com/dsherret/ts-morph/pull/1398.tranform to work with Nodes from another parsed source file by @ivanhofer in https://github.com/dsherret/ts-morph/pull/1417Full Changelog: https://github.com/dsherret/ts-morph/compare/18.0.0...19.0.0
<a name="18.0.0"></a>
BREAKING CHANGE: Upgraded to TypeScript 5.0.2
BREAKING CHANGE: Upgraded to TypeScript 5.0.2
Full Changelog: https://github.com/dsherret/ts-morph/compare/17.0.1...18.0.0
<a name="17.0.1"></a>
<a name="17.0.0"></a>
fix: revert rollup from v3 to v2 to fix build (esModuleInterop: true had no effect) #1358
esModuleInterop: true had no effect) #1358getOverloads for a class method should take into account if static (#1337) (f927d01), closes #1298
OrThrow methods (#1327) (05916d3) - Thanks @jantimon!ts.createX functions seem almost completely deprecated in TS 4.8, so make sure to update your code to use the traversal.context.createX functions inst…
Type#isNever() (ac0db0d), closes #1303Type#isReadonlyArray() and Type#isArray() also includes readonly arrays (f1d5c43), closes #1306 #1305ts.createX functions seem almost completely deprecated in TS 4.8, so make sure to update your code to use the traversal.context.createX functions insteadType#isArray() returns true for readonly arraysDocumentSpan should attempt to load the source file if it's not loaded yet
transform() - ensure comments on nodes with only added synthetic leading comments show up in output (abc840d), closes #1273
transform() - ensure comments on nodes with only added synthetic leading comments show up in output (abc840d), closes #1273Node#isKind(kind) type guard (#1271) (79ab80f)transform now returns a Node instead of this because the returned node could be the replaced node.AssertEntry#getValue now returns an expression instead of a string literal.
AssertEntry#getValue now returns an expression instead of a string literal.AssertEntryStructure#value now represents an expression instead of a string literal.<a name="13.0.3"></a>
<a name="13.0.2"></a>
/node_modules/typescript/lib folder getting saved to the file system sometimes (a655c65)<a name="13.0.1"></a>
getReferencingNodesInOtherSourceFiles with source files not marked as in the project (7504aed), closes #1227 #1195getScriptSnapshot compiler host libFileMap behaviour with readFile (9e84d72)<a name="13.0.0"></a>
Nothing published for this version
Nothing published for this version
Regression in getReferencingNodesInOtherSourceFiles with source files not marked as in the project
Remove already deprecated WriterFunctions and TypeGuards exports.
Node.isXNode(node) static type guard methods are now Node.isX(node) (e5bcba9), closes #1166WriterFunctions and TypeGuards exports. (be87373)AssertClause and AssertEntry (#1224) (bcf694f)Node.hasStructure type guard. (0f7d9be)readDirSync to return directory entries instead of file paths (f22a50d)Structure.isX function more flexible (a54dd69), closes #1219ImportSpecifier and ExportSpecifier (e93c96e)Node.isXNode(node)-like static type guard methods are now Node.isX(node) to reduce verbosity.WriterFunctions and TypeGuards exports. Use Writers and Node instead.readDirSync now returns directory entries.### Features - Wrap TypeQueryNode
Support renaming a property to a private identifier or vice versa
deno: avoid importing code using unstable APIs (2a0789c) - Thanks @wojpawlik!
<a name="11.0.3"></a>
<a name="11.0.1"></a>
Node.isReferenceFindableNode(node) should return true for a constructor declaration. (b8b0a39)<a name="11.0.0"></a>
Nothing published for this version
Nothing published for this version
### Features - #1156 - Add ReferenceFindableNode to ConstructorDeclaration. (e192d41) - TypeScript 4.3 Support (cd426a0) ### BREAKING CHANGES - Upgrad
Handle comma separated definitions with DefinitionInfo#getDeclarationNode (#1158) (a390e94) - Thanks @IgorMinar!
Node#asKind(kind: SyntaxKind) and Node#asKindOrThrow(kind: SyntaxKind) methods. (58bb5cc)<a name="10.0.2"></a>
<a name="10.0.1"></a>
<a name="10.0.0"></a>
Nothing published for this version
Nothing published for this version
Upgraded to TS 4.2 (see TypeScript blog for breaking changes).
ExportedDeclarations should include SourceFile and fixed handling of namespace exports. (b6bda27)Node#getFlags(). (b9769c2)NamespaceDeclaration is ModuleDeclaration. You will need to rename anything that references "Namespace" and change it to "Module".ExportedDeclarations union type now properly includes SourceFile. It previously could have done that anyway and your code might not have handled it.import { ts } from "ts-morph" as you should have been doing anyway.libFolderPath in the Project constructor's options.<a name="9.1.0"></a>
Support providing file paths to getRelativePathTo and getRelativePathToAsModuleSpecifier.
Previously ts-morph was incorrectly resolving files based on rootDir and rootDirs, but according to the nicely updated tsconfig documentation, these o
Previously ts-morph was incorrectly resolving files based on rootDir and rootDirs, but according to the nicely updated tsconfig documentation, these options have nothing to do with file resolution (read more). If you run into any trouble, try using "include": ["./your-source-dir"] at the top level of the config file instead of "rootDir": ["./your-source-dir"] in compiler options or please open an issue.
addFilesFromTsConfig is now inverted to skipAddingFilesFromTsConfig. Default behaviour is the same. (1fda310)BooleanLiteral and replace with TrueLiteral and FalseLiteral. (97f0873)getProjectVersion on LanguageServiceHost (#884) (916ffb4, 646f797) - Thanks @geremih!addFilesFromTsConfig is now inverted to skipAddingFilesFromTsConfig. Default behaviour is the same.This was done to make the option align with the other options.
BooleanLiteral is now a type alias of TrueLiteral and FalseLiteral. This was done to match the same change made in the compiler API.<a name="8.2.0"></a>
Add Project#getConfigFileParsingDiagnostics.
Nothing published for this version
Nothing published for this version
### Features - #803 - Standardize nodes with getExpression() method to be ExpressionedNodes. (3550cbf) - Add JSDocDeprecatedTag.
TupleTypeNode#getElementTypeNodes() is now getElements() to match the change in the compiler API.
Upgraded to TypeScript 4.0
TupleTypeNode#getElementTypeNodes() is now getElements() to match the change in the compiler API.
<a name="7.3.0"></a>
### Features - #842 - Allow calling Node.is functions with undefined value (fff2cf8) - Thanks @sisisin!
Add quotations around enum members with invalid names (#839) (affc253) Thanks @jeswr!
<a name="7.1.3"></a>
<a name="7.1.2"></a>
<a name="7.1.1"></a>
<a name="7.1.0"></a>
Nothing published for this version
Nothing published for this version
Nothing published for this version
manipulation: #807 - Optimise getTextFromTextChanges performance (d6f461f) - Thanks @killagu!
<a name="7.0.3"></a>
<a name="7.0.2"></a>
<a name="7.0.1"></a>
<a name="7.0.0"></a>
Nothing published for this version
Nothing published for this version
Nothing published for this version
Only Node 10+ has full support. Some functionality might not work on older versions of Node.
Node#getProject() (35f6bcf)<a name="6.0.2"></a>
<a name="6.0.1"></a>
I unpublished 6.0.0 and published this version instead.
JSDocTag#getStructure() was not including newlines at the start in the text. (543c7e6)Structures should contain JSDocTagStructure (f9f8bbc)<a name="6.0.0"></a>
Nothing published for this version
Nothing published for this version
Accidentally released with no jsdocs.
…The old way will be deprecated in Version 6.
Project#addSourceFileAtPath(path) methods instead of the ones like Project#addExistingSourceFile(path). The old way will be deprecated in Version 6.<a name="4.3.3"></a>
<a name="4.3.2"></a>
<a name="4.3.0"></a>
Nothing published for this version
Nothing published for this version
Nothing published for this version
Add Node#getWidth(true) for including js docs in the width (similar to Node#getStart(true) in the compiler api).
Fix abstract keyword accidentally being printed before scope.
getExpressionIfKind methods. (332fb7e)useTrailingCommas manipulation setting option. (938c05c)forgetNodesCreatedInBlock to allow returning a value. (fda5970)Node#forEachDescendantAsArray (2043ccb)<a name="4.1.1"></a>
getNonWhitespaceStart() should not include the previous node's trailing comment. (380c39b)<a name="4.1.0"></a>
Your coding agent can read these notes before it upgrades. Set up the MCP server →