NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #1816 most downloaded on npm
utilities for working with typescript's AST
Last release 6 years ago
no release in 18 months
Ships unpredictably
gaps range from 9 days to 1.4 years
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
94 releases · first in 2017
getPropertyNameOfWellKnownSymbol is now deprecated
Features:
getWellKnownSymbolPropertyOfType to reliably get symbol named properties due to changes in typescript@4.3getPropertyNameOfWellKnownSymbol is now deprecatedfindImports and findImportLikeNodes take an additional parameter ignoreFileName . The default value for this paramter is true to remain backwards comp
Features:
findImports and findImportLikeNodes take an additional parameter ignoreFileName. The default value for this paramter is true to remain backwards compatible. When set to false, it matches the behavior of TypeScript, i.e. only looks for require in JavaScript files.Bugfixes:
getJsDoc for EndOfFileToken now returns JSDoc comments whose contents are usable with the type checkerOne column per quarter.
getSymbolOfClassLikeDeclaration no longer crashes on anonymous mixin classes
Bugfixes:
getSymbolOfClassLikeDeclaration no longer crashes on anonymous mixin classesgetSymbolOfClassLikeDeclaration to retrieve the symbol of class declarations and expressions regardless whether they have a name or not
Features:
getSymbolOfClassLikeDeclaration to retrieve the symbol of class declarations and expressions regardless whether they have a name or notgetBaseOfClassLikeDeclaration to conventiently get the expression after extendsgetBaseClassMemberOfClassElement to look up the declaration of a class member in the base classBugfixes:
getConstructorTypeOfClassLikeDeclaration now really returns the constructor type (the static side of the class), previously it returned the instance typehasExhaustiveCaseClauses allows additional case clauses with null, undefined and nevergetCheckJsDirective is now deprecated
Features:
callExpressionAffectsControlFlow to determine whether a CallExpression affects control flow by returning never or assertshasExhaustiveCaseClauses to determine whether a SwitchStatement's CaseClauses handle every possible valueendsControlFlow and getControlFlowEnd take an optional checker parameter to recognize exhaustive SwitchStatements and control flow effects of CallExpressionsformatPseudoBigInt converts TypeScript's representation of a BigInt to its literal representation as you would write it in your source codegetAstNodeAtPosition similar to getTokenAtPosition, but only operates on AST NodesremoveOptionalChainingUndefinedMarkerType and isOptionalChainingUndefinedMarkerType to handle types originating in an optional chainfindImports and findImportLikeNodes: prepare for import assertionsgetTsCheckDirective as new name for getCheckJsDirectivegetCheckJsDirective is now deprecatedBugfixes:
getUsageDomain: handles NamespaceExport and NamedTupleMembergetPropertyName: handles parentheses and negative numeric literals, excludes RegExp literals and private identifiersgetSingleLateBoundPropertyNameOfPropertyName and getLateBoundPropertyNamesOfPropertyName: handles private identifiershasAccessModifier: handles JSDoc access modifierhasSideEffects: correctly determines side effects of (static) property initializersisExpressionValueUsed: handle nullish coalescing and conditional assignment operatorscanHaveJsDoc: aligned with upstream changes in TypeScriptisCompilerOptionEnabled:
noUncheckedIndexedAccess requires strictNullCheckscheckJs implies allowJsemitDeclarationOnly requires declarationisInConstContext: handle template string interpolationsisValidJsxIdentifier , isValidPropertyAccess , isValidPropertyName : fix unicode character width handling
Bugfixes:
isValidJsxIdentifier, isValidPropertyAccess, isValidPropertyName: fix unicode character width handlingisValidJsxIdentifier added an optional parameter to specify the target ECMAScript version
Features:
isValidJsxIdentifier added an optional parameter to specify the target ECMAScript versionBugfixes:
isValidJsxIdentifier now handles astral plane charactersadded getIteratorYieldResultFromIteratorResult to extract the yield ed type from IteratorResult<TYield, TReturn, TNext>
Features:
getIteratorYieldResultFromIteratorResult to extract the yielded type from IteratorResult<TYield, TReturn, TNext>isValidIdentifier , isValidPropertyName , isValidPropertyAccess , isValidNumericLiteral added an optional parameter to specify the target ECMAScript v
Features:
isValidIdentifier, isValidPropertyName, isValidPropertyAccess, isValidNumericLiteral added an optional parameter to specify the target ECMAScript versionBugfixes:
isValidPropertyName, isValidPropertyAccess now handle astral plane charactersfindImports : fixed crash on nested namespaces
Bugfixes:
findImports: fixed crash on nested namespacesadded getInstanceTypeOfClassLikeDeclaration and getConstructorTypeOfClassLikeDeclaration
Features:
getInstanceTypeOfClassLikeDeclaration and getConstructorTypeOfClassLikeDeclarationAccessKind.Delete to getAccessKind: getAccessKind(node) & AccessKind.Modification can now be used to restore the old behavior of isReassignmentTarget(node)getAccessKind determines whether an expression is read from, written to or both
Features:
getAccessKind determines whether an expression is read from, written to or bothgetPropertyOfType for unambiguous property names to partially work around https://github.com/microsoft/TypeScript/issues/31565Bugfixes:
isReassignmentTarget no longer returns true for DeleteExpression as it doesn't assign a value to the operandgetLateBoundPropertyNamesOfPropertyName returns all statically analyzable names of a property, method, ...
Features:
getLateBoundPropertyNamesOfPropertyName returns all statically analyzable names of a property, method, ...getSingleLateBoundPropertyNameOfPropertyName returns the literal name of a property, method, ... if statically analyzableBugfixes:
typeguards: isNumericOrStringLikeLiteral, isTupleTypeReference
Features:
isNumericOrStringLikeLiteral, isTupleTypeReferenceintersectionTypeParts as counterpart to unionTypePartssomeTypePart to execute a callback for each union or intersection constituent until the callback returns truegetPropertyOfType looks up a property by its escaped nameisPropertyReadonlyInType determines whether a property in a given type cannot be written tosymbolHasReadonlyDeclaration determines if a Symbol has any readonly or constant declarationisNumericPropertyName determines whether a property name would match an index signatureisBindableObjectDefinePropertyCall returns true for statically analyzable forms of Object.defineProperty(o, 'p', {value, writable})isReadonlyAssignmentDeclaration determines whether an Object.defineProperty call is known to result in a readonly propertygetLateBoundPropertyNames returns all known property names of an expressiongetPropertyNameFromType extracts the property name of literal typesisWellKnownSymbolLiterally to recognize expressions in the form of Symbol.<name>getPropertyNameOfWellKnownSymbol returns the escaped name for a well known symbol literalunwrapParentheses returns the first child expression that is not a ParenthesizedExpressionisCompilerOptionEnabled: incremental is implicitly enabled by composite
Features:
isCompilerOptionEnabled: incremental is implicitly enabled by compositeBugfixes:
collectVariableUsage/getUsageDomain: no longer treat as const as type usagereverted invalid deprecation of canHaveJsdoc
Bugfixes:
canHaveJsdocparseJsdocOfNodeadded typeguards: isNullLiteral and isBooleanLiteral
Features:
isNullLiteral and isBooleanLiteralexposes typeguards for typescript@3.2 by default
Features:
isConstAssertion and isInConstContextadded isBlockScopedDeclarationStatement
Features:
isBlockScopedDeclarationStatementisInSingleStatementContextadded getCheckJsDirective utility to parse // @ts-check and // @ts-nocheck pragmas
Features:
getCheckJsDirective utility to parse // @ts-check and // @ts-nocheck pragmasPublished declaration files no longer contain const enum. They are now declared as regular enums instead.
Bugfixes:
const enum. They are now declared as regular enums instead.isThenableType allows Node instead of Expression as parameter
Bugfixes:
isThenableType allows Node instead of Expression as parameterisBlockScopeBoundary and isScopeBoundary consider WithStatement as scope boundarycorrectly handle BigInt literals
Features:
isBigIntLiteralisLiteralType recognises BigIntgetPropertyName adds special handling for BigIntadded utility commentText to get the actual text content of a comment excluding the characters needed to start and end the comment
Features:
commentText to get the actual text content of a comment excluding the characters needed to start and end the commentfindImports: fixed handling of ImportEqualsDeclaration
Bugfixes:
findImports: fixed handling of ImportEqualsDeclarationisCompilerOptionEnabled: recognizes strictBindCallApply
Features:
isCompilerOptionEnabled: recognizes strictBindCallApplygetTokenAtPosition: optionally includes JSDoc during lookupBugfixes:
isCompilerOptionEnabled: correctly implements logic for allowSyntheticDefaultImportsfindImportLikeNodes: correctly finds imports in namespacesfindImportLikeNodes / findImports: finds import types in JSDoc of JS filesadded utility findImportLikeNodes that works similar to findImports but returns the import statement or expression instead of the module specifier and
Features:
findImportLikeNodes that works similar to findImports but returns the import statement or expression instead of the module specifier and doesn't filter non-string module specifiersadded utilities: isKeywordKind and isValidJsxIdentifier
Features:
isKeywordKind and isValidJsxIdentifierDropped support for typescript@<2.8.0
:warning: Breaking Changes:
typescript@<2.8.0getIdentifierText, isJsxFramgment, ImportOptionsisModifierFlagSet, findImports and getControlFlowEnd'tsutils/util/util', import directly from 'tsutils/util/control-flow' or 'tsutils/util'isFunctionScopeBoundary and isBlockScopeBoundary now return a enum member of ScopeBoundary instead of a booleanisFunctionScopeBoundary no longer returns a truthy value for InterfaceDeclaration, TypeAliasDeclarationFeatures:
isTypeScopeBoundary returning ScopeBoundary.Type or ScopeBoundary.ConditionalTypeScopeBoundarySelector whose members can be used to determine if a declaration belongs to a given ScopeBoundary by using bitwise ANDBugfixes:
collectVariableUsage now correctly handles infer T nested inside function signatures or mapped typesisCompilerOptionEnabled correctly handles skipDefaultLibCHeck and suppressImplicitAnyIndexErrorsadded utility isCompilerOptionEnabled
Features:
isCompilerOptionEnabledTypeguards are now split into multiple submodules for each version of TypeScript (starting with 2.8.0). That means you can now import directly from "t
Typeguards are now split into multiple submodules for each version of TypeScript (starting with 2.8.0).
That means you can now import directly from "tsutils/typeguard/2.8" to get compatible declaraton files for TypeScript@2.8.
For more information please read the relevant section in README.md.
Features:
isTupleType, isOptionalTypeNode, isRestTypeNode, isSyntheticExpression (currently available from "tsutils/typeguard/3.0")isStrictCompilerOptionEnabledAvoid crash caused by removed function in typescript@3.0.0.
Avoid crash caused by removed function in typescript@3.0.0.
Added support for TypeScript@3.0.0 nightly builds.
Added support for TypeScript@3.0.0 nightly builds.
Features: * added getIIFE utility
Features:
getIIFE utilityforEachComment and forEachTokenWithTrivia no longer duplicate comments around missing nodes
Bugfixes:
forEachComment and forEachTokenWithTrivia no longer duplicate comments around missing nodesfixed crash in hasSideEffects with tagged template literal without substitution: `tagtemplate `
Bugfixes:
hasSideEffects with tagged template literal without substitution: tag`template` added typeguard isLiteralTypeNode
Features:
isLiteralTypeNodetype T = import('foo')) to findImports via ImportKind.ImportTypecollectVariableUsage: fixed name lookup in function signatures to match runtime behavior. Note that this is not completely fixed in TypeScript, yet. S
Bugfixes:
collectVariableUsage: fixed name lookup in function signatures to match runtime behavior. Note that this is not completely fixed in TypeScript, yet. See: Microsoft/TypeScript#22825 and Microsoft/TypeScript#22769added utilities: isStatementInAmbientContext and isAmbientModuleBlock
Features:
isStatementInAmbientContext and isAmbientModuleBlockadded typeguards for typescript@2.8: isConditionalTypeNode, isInferTypeNode, isConditionalType, isInstantiableType, isSubstitutionType
Features:
isConditionalTypeNode, isInferTypeNode, isConditionalType, isInstantiableType, isSubstitutionTypeadded typeguard isForInOrOfStatement
Features:
isForInOrOfStatementBugfixes:
<MyComponent<string>/*comment*/></MyComponent><div><br/>/*no comment*/</div>collectVariableUsage: handle ConditionalTypes and infer T, which will be introduced in TypeScript@2.8.0 and are already available in nightly builds
Bugfixes:
collectVariableUsage: handle ConditionalTypes and infer T, which will be introduced in TypeScript@2.8.0 and are already available in nightly buildsisLiteralType no longer returns true for ts.TypeFlags.BooleanLiteral as this is not a ts.LiteralTypehandle loops that might not even run a single iteration
Bugfixes:
endsControlFlow:
Features: * added isFalsyType utility
Features:
isFalsyType utilityfixed compile error with typescript@2.8.0-dev
Bugfixes:
typescript@2.8.0-devisReassignmentTarget: handle type assertions and non-null assertion
Bugfixes:
isReassignmentTarget: handle type assertions and non-null assertionforEachDeclaredVariable uses a more precise type for the callback parameter to make it useable again with typescript@2.7.1
Bugfixes:
forEachDeclaredVariable uses a more precise type for the callback parameter to make it useable again with typescript@2.7.1Features:
isUniqueESSymbolType typeguardFeatures: * added isThenableType utility * added unionTypeParts utility
Features:
isThenableType utilityunionTypeParts utilityforEachComment, getCommentAtPosition and isPositionInComment: skip shebang (#! something) to not miss following comments at the start of the file
Bugfixes:
forEachComment, getCommentAtPosition and isPositionInComment: skip shebang (#! something) to not miss following comments at the start of the fileadded WrappedAst interface that models the type of a wrapped SourceFile more accurate
Features:
WrappedAst interface that models the type of a wrapped SourceFile more accurategetWrappedNodeAtPosition utiltiy that takes a NodeWrap and returns the most deeply nested NodeWrap that contains the given positiondeprecated overload of getControlFlowEnd that contains the label parameter. This parameter is no longer used and should no longer be passed to the fun…
Features:
getControlFlowEnd accepts BlockLike as argumentBugfixes:
getControlFlowEnd and endsControlFlow: correctly handle nested LabeledStatementsendsControlFlow removed erroneous special case when an IterationStatement is passed as argument whose parent is a LabeledStatement.
Deprecations:
getControlFlowEnd that contains the label parameter. This parameter is no longer used and should no longer be passed to the function.getControlFlowEnd and endsControlFlow
Bugfixes:
getControlFlowEnd and endsControlFlow (#22)
try are filtered out if there is a catch clausecatch only end control flow if try AND catch definitely end control flowadded kind property to NodeWrap
Features:
kind property to NodeWrapgetControlFlowEnd to public APIadded isDecorator and isCallLikeExpression typeguards
Features:
isDecorator and isCallLikeExpression typeguardsadded convertAst utility to produce a flattened and wrapped version of the AST
Features:
convertAst utility to produce a flattened and wrapped version of the ASTFeatures: * added isDeleteExpression * added getLineBreakStyle
Features:
isDeleteExpressiongetLineBreakStyleBugfixes: * fixed name of isJsxFragment
Bugfixes:
isJsxFragmentadded support for JsxFragment introduced in typescript@2.6.2
Features:
JsxFragment introduced in typescript@2.6.2added missing logic for labeled statement, iteration statements and try-catch
Bugfixes:
endsControlFlow
break and continue with labelsisValidIdentifier and isValidNumericLiteral handle irregular whitespacefindImports searches in ambient modules inside regular .ts files (not only .d.ts)canHaveJsDoc is now a typeguardhandles irregular whitespace and no longer visits some tokens twice
Bugfixes:
forEachTokenWithTrivia
Your coding agent can read these notes before it upgrades. Set up the MCP server →