ts-morph
- Version 25.0.1
- Published
- 1.43 MB
- 2 dependencies
- MIT license
Install
npm i ts-morph
yarn add ts-morph
pnpm add ts-morph
Overview
TypeScript compiler wrapper for static analysis and code manipulation.
Index
Variables
- ArgumentError
- ArgumentNullOrWhitespaceError
- ArgumentOutOfRangeError
- ArgumentTypeError
- ArrayDestructuringAssignmentBase
- ArrowFunctionBase
- AsExpressionBase
- AssignmentExpressionBase
- AwaitExpressionBase
- BaseError
- BigIntLiteralBase
- BinaryExpressionBase
- BindingElementBase
- BlockBase
- CallExpressionBase
- CallSignatureDeclarationBase
- CaseBlockBase
- CaseClauseBase
- CatchClauseBase
- ClassDeclarationBase
- ClassExpressionBase
- ClassStaticBlockDeclarationBase
- CommaListExpressionBase
- ComputedPropertyNameBase
- ConditionalExpressionBase
- ConstructorDeclarationBase
- ConstructorDeclarationOverloadBase
- ConstructorTypeNodeBase
- ConstructSignatureDeclarationBase
- DebuggerStatementBase
- DecoratorBase
- DefaultClauseBase
- DeleteExpressionBase
- DirectoryNotFoundError
- DoStatementBase
- ElementAccessExpressionBase
- EmptyStatementBase
- EnumDeclarationBase
- EnumMemberBase
- ExportAssignmentBase
- ExportDeclarationBase
- ExportSpecifierBase
- ExpressionStatementBase
- ExpressionWithTypeArgumentsBase
- ExternalModuleReferenceBase
- FalseLiteralBase
- FileNotFoundError
- ForInStatementBase
- ForOfStatementBase
- ForStatementBase
- FunctionDeclarationBase
- FunctionDeclarationOverloadBase
- FunctionExpressionBase
- FunctionOrConstructorTypeNodeBaseBase
- FunctionTypeNodeBase
- GetAccessorDeclarationBase
- IdentifierBase
- IfStatementBase
- ImportAttributeBase
- ImportAttributesBase
- ImportClauseBase
- ImportDeclarationBase
- ImportEqualsDeclarationBase
- ImportExpressionBase
- ImportSpecifierBase
- IndexSignatureDeclarationBase
- InterfaceDeclarationBase
- InvalidOperationError
- JSDocBase
- JSDocFunctionTypeBase
- JSDocOverloadTagBase
- JSDocParameterTagBase
- JSDocPropertyTagBase
- JSDocReturnTagBase
- JSDocSatisfiesTagBase
- JSDocSeeTagBase
- JSDocTagBase
- JSDocTemplateTagBase
- JSDocThisTagBase
- JSDocThrowsTagBase
- JsxAttributeBase
- JsxClosingElementBase
- JsxElementBase
- JsxExpressionBase
- JsxNamespacedNameBase
- JsxOpeningElementBase
- JsxSelfClosingElementBase
- JsxSpreadAttributeBase
- JsxTextBase
- LabeledStatementBase
- LiteralExpressionBase
- MetaPropertyBase
- MethodDeclarationBase
- MethodDeclarationOverloadBase
- MethodSignatureBase
- ModuleBlockBase
- ModuleDeclarationBase
- NamedExportsBase
- NamedImportsBase
- NamedTupleMemberBase
- NamespaceExportBase
- NamespaceImportBase
- NewExpressionBase
- NodeWithTypeArgumentsBase
- NonNullExpressionBase
- NoSubstitutionTemplateLiteralBase
- NotEmittedStatementBase
- NotImplementedError
- NotSupportedError
- NullLiteralBase
- NumericLiteralBase
- ObjectDestructuringAssignmentBase
- ObjectLiteralExpressionBase
- OmittedExpressionBase
- ParameterDeclarationBase
- ParenthesizedExpressionBase
- PartiallyEmittedExpressionBase
- PathNotFoundError
- PostfixUnaryExpressionBase
- PrefixUnaryExpressionBase
- PrivateIdentifierBase
- PropertyAccessExpressionBase
- PropertyAssignmentBase
- PropertyDeclarationBase
- PropertySignatureBase
- RegularExpressionLiteralBase
- ResolutionHosts
- ReturnStatementBase
- SatisfiesExpressionBase
- SetAccessorDeclarationBase
- ShorthandPropertyAssignmentBase
- SourceFileBase
- SpreadAssignmentBase
- SpreadElementBase
- StatementBase
- StringLiteralBase
- Structure
- SuperElementAccessExpressionBase
- SuperExpressionBase
- SuperPropertyAccessExpressionBase
- SwitchStatementBase
- TemplateExpressionBase
- TemplateHeadBase
- TemplateMiddleBase
- TemplateSpanBase
- TemplateTailBase
- ThisExpressionBase
- ThrowStatementBase
- TrueLiteralBase
- TryStatementBase
- TypeAliasDeclarationBase
- TypeAssertionBase
- TypeLiteralNodeBase
- TypeOfExpressionBase
- TypeParameterDeclarationBase
- VariableDeclarationBase
- VariableDeclarationListBase
- VariableStatementBase
- VoidExpressionBase
- WhileStatementBase
- WithStatementBase
- YieldExpressionBase
Functions
- AbstractableNode()
- AmbientableNode()
- ArgumentedNode()
- AsyncableNode()
- AwaitableNode()
- BaseExpressionedNode()
- BindingNamedNode()
- BodiedNode()
- BodyableNode()
- ChildOrderableNode()
- ClassLikeDeclarationBase()
- ClassLikeDeclarationBaseSpecific()
- CommonIdentifierBase()
- createWrappedNode()
- DecoratableNode()
- DotDotDotTokenableNode()
- ExclamationTokenableNode()
- ExportableNode()
- ExportGetableNode()
- ExpressionableNode()
- ExpressionedNode()
- ExtendsClauseableNode()
- forEachStructureChild()
- FunctionLikeDeclaration()
- GeneratorableNode()
- getCompilerOptionsFromTsConfig()
- HeritageClauseableNode()
- ImplementsClauseableNode()
- ImportAttributeNamedNode()
- ImportExpressionedNode()
- InitializerExpressionableNode()
- InitializerExpressionGetableNode()
- JSDocableNode()
- JSDocPropertyLikeTag()
- JSDocTypeExpressionableTag()
- JSDocTypeParameteredTag()
- JsxAttributedNode()
- JsxTagNamedNode()
- LeftHandSideExpressionedNode()
- LiteralLikeNode()
- ModifierableNode()
- ModuleChildableNode()
- ModuledNode()
- ModuleNamedNode()
- NameableNode()
- NamedNode()
- NamedNodeBase()
- OverloadableNode()
- OverrideableNode()
- ParameteredNode()
- printNode()
- PropertyNamedNode()
- QuestionDotTokenableNode()
- QuestionTokenableNode()
- ReadonlyableNode()
- ReferenceFindableNode()
- RenameableNode()
- ReturnTypedNode()
- ScopeableNode()
- ScopedNode()
- SignaturedDeclaration()
- StatementedNode()
- StaticableNode()
- SuperExpressionedNode()
- TextInsertableNode()
- TypeArgumentedNode()
- TypedNode()
- TypeElementMemberedNode()
- TypeParameteredNode()
- UnaryExpressionedNode()
- UnwrappableNode()
Classes
CodeBlockWriter
- blankLine()
- blankLineIfLastNot()
- block()
- closeComment()
- conditionalBlankLine()
- conditionalNewLine()
- conditionalWrite()
- conditionalWriteLine()
- endsWith()
- getIndentationLevel()
- getLastChar()
- getLength()
- getOptions()
- hangingIndent()
- hangingIndentUnlessBlock()
- indent()
- inlineBlock()
- isAtStartOfFirstLineOfBlock()
- isInComment()
- isInString()
- isLastBlankLine()
- isLastNewLine()
- isLastSpace()
- isLastTab()
- isOnFirstLineOfBlock()
- iterateLastCharCodes()
- iterateLastChars()
- newLine()
- newLineIfLastNot()
- queueIndentationLevel()
- quote()
- setIndentationLevel()
- space()
- spaceIfLastNot()
- tab()
- tabIfLastNot()
- toString()
- unsafeInsert()
- withIndentationLevel()
- write()
- writeLine()
Decorator
- addArgument()
- addArguments()
- addTypeArgument()
- addTypeArguments()
- getArguments()
- getCallExpression()
- getCallExpressionOrThrow()
- getFullName()
- getName()
- getNameNode()
- getParent()
- getParentOrThrow()
- getStructure()
- getTypeArguments()
- insertArgument()
- insertArguments()
- insertTypeArgument()
- insertTypeArguments()
- isDecoratorFactory()
- remove()
- removeArgument()
- removeTypeArgument()
- set()
- setIsDecoratorFactory()
Directory
- addDirectoryAtPath()
- addDirectoryAtPathIfExists()
- addSourceFileAtPath()
- addSourceFileAtPathIfExists()
- addSourceFilesAtPaths()
- clear()
- clearImmediately()
- clearImmediatelySync()
- copy()
- copyImmediately()
- copyImmediatelySync()
- copyToDirectory()
- createDirectory()
- createSourceFile()
- delete()
- deleteImmediately()
- deleteImmediatelySync()
- emit()
- emitSync()
- forget()
- getBaseName()
- getDescendantDirectories()
- getDescendantSourceFiles()
- getDirectories()
- getDirectory()
- getDirectoryOrThrow()
- getParent()
- getParentOrThrow()
- getPath()
- getProject()
- getRelativePathAsModuleSpecifierTo()
- getRelativePathTo()
- getSourceFile()
- getSourceFileOrThrow()
- getSourceFiles()
- isAncestorOf()
- isDescendantOf()
- move()
- moveImmediately()
- moveImmediatelySync()
- moveToDirectory()
- save()
- saveSync()
- wasForgotten()
ExportDeclaration
- addNamedExport()
- addNamedExports()
- getAttributes()
- getModuleSpecifier()
- getModuleSpecifierSourceFile()
- getModuleSpecifierSourceFileOrThrow()
- getModuleSpecifierValue()
- getNamedExports()
- getNamespaceExport()
- getNamespaceExportOrThrow()
- getParent()
- getParentOrThrow()
- getStructure()
- hasModuleSpecifier()
- hasNamedExports()
- insertNamedExport()
- insertNamedExports()
- isModuleSpecifierRelative()
- isNamespaceExport()
- isTypeOnly()
- removeModuleSpecifier()
- set()
- setAttributes()
- setIsTypeOnly()
- setModuleSpecifier()
- setNamespaceExport()
- toNamespaceExport()
ImportDeclaration
- addNamedImport()
- addNamedImports()
- getAttributes()
- getDefaultImport()
- getDefaultImportOrThrow()
- getImportClause()
- getImportClauseOrThrow()
- getModuleSpecifier()
- getModuleSpecifierSourceFile()
- getModuleSpecifierSourceFileOrThrow()
- getModuleSpecifierValue()
- getNamedImports()
- getNamespaceImport()
- getNamespaceImportOrThrow()
- getParent()
- getParentOrThrow()
- getStructure()
- insertNamedImport()
- insertNamedImports()
- isModuleSpecifierRelative()
- isTypeOnly()
- removeDefaultImport()
- removeNamedImports()
- removeNamespaceImport()
- renameDefaultImport()
- set()
- setAttributes()
- setDefaultImport()
- setIsTypeOnly()
- setModuleSpecifier()
- setNamespaceImport()
LanguageService
- compilerObject
- findReferences()
- findReferencesAsNodes()
- findReferencesAtPosition()
- findRenameLocations()
- getCodeFixesAtPosition()
- getCombinedCodeFix()
- getDefinitions()
- getDefinitionsAtPosition()
- getEditsForRefactor()
- getEmitOutput()
- getFormattedDocumentText()
- getFormattingEditsForDocument()
- getFormattingEditsForRange()
- getIdentationAtPosition()
- getImplementations()
- getImplementationsAtPosition()
- getProgram()
- getSuggestionDiagnostics()
- organizeImports()
Node
- appendWhitespace()
- asKind()
- asKindOrThrow()
- compilerNode
- containsRange()
- forEachChild()
- forEachChildAsArray()
- forEachDescendant()
- forEachDescendantAsArray()
- forget()
- forgetDescendants()
- formatText()
- getAncestors()
- getChildAtIndex()
- getChildAtIndexIfKind()
- getChildAtIndexIfKindOrThrow()
- getChildAtPos()
- getChildCount()
- getChildIndentationLevel()
- getChildIndentationText()
- getChildIndex()
- getChildren()
- getChildrenOfKind()
- getChildSyntaxList()
- getChildSyntaxListOrThrow()
- getCombinedModifierFlags()
- getDescendantAtPos()
- getDescendantAtStartWithWidth()
- getDescendants()
- getDescendantsOfKind()
- getDescendantStatements()
- getEnd()
- getEndLineNumber()
- getFirstAncestor()
- getFirstAncestorByKind()
- getFirstAncestorByKindOrThrow()
- getFirstAncestorOrThrow()
- getFirstChild()
- getFirstChildByKind()
- getFirstChildByKindOrThrow()
- getFirstChildIfKind()
- getFirstChildIfKindOrThrow()
- getFirstChildOrThrow()
- getFirstDescendant()
- getFirstDescendantByKind()
- getFirstDescendantByKindOrThrow()
- getFirstDescendantOrThrow()
- getFlags()
- getFullStart()
- getFullText()
- getFullWidth()
- getIndentationLevel()
- getIndentationText()
- getKind()
- getKindName()
- getLastChild()
- getLastChildByKind()
- getLastChildByKindOrThrow()
- getLastChildIfKind()
- getLastChildIfKindOrThrow()
- getLastChildOrThrow()
- getLastToken()
- getLeadingCommentRanges()
- getLeadingTriviaWidth()
- getLocal()
- getLocalOrThrow()
- getLocals()
- getNextSibling()
- getNextSiblingIfKind()
- getNextSiblingIfKindOrThrow()
- getNextSiblingOrThrow()
- getNextSiblings()
- getNodeProperty()
- getNonWhitespaceStart()
- getParent()
- getParentIf()
- getParentIfKind()
- getParentIfKindOrThrow()
- getParentIfOrThrow()
- getParentOrThrow()
- getParentSyntaxList()
- getParentSyntaxListOrThrow()
- getParentWhile()
- getParentWhileKind()
- getParentWhileKindOrThrow()
- getParentWhileOrThrow()
- getPos()
- getPreviousSibling()
- getPreviousSiblingIfKind()
- getPreviousSiblingIfKindOrThrow()
- getPreviousSiblingOrThrow()
- getPreviousSiblings()
- getProject()
- getSourceFile()
- getStart()
- getStartLineNumber()
- getStartLinePos()
- getSymbol()
- getSymbolOrThrow()
- getSymbolsInScope()
- getText()
- getTrailingCommentRanges()
- getTrailingTriviaEnd()
- getTrailingTriviaWidth()
- getType()
- getWidth()
- hasBody()
- hasExpression()
- hasName()
- hasStructure()
- is()
- isAbstractable()
- isAmbientable()
- isAnyKeyword
- isArgumented()
- isArrayBindingPattern
- isArrayLiteralExpression
- isArrayTypeNode()
- isArrowFunction
- isAsExpression
- isAsyncable()
- isAwaitable()
- isAwaitExpression
- isBigIntLiteral
- isBinaryExpression
- isBindingElement
- isBindingNamed()
- isBlock
- isBodied()
- isBodyable()
- isBooleanKeyword
- isBreakStatement
- isCallExpression
- isCallSignatureDeclaration()
- isCaseBlock
- isCaseClause
- isCatchClause
- isChildOrderable()
- isClassDeclaration
- isClassExpression
- isClassLikeDeclarationBase()
- isClassStaticBlockDeclaration
- isCommaListExpression
- isCommentClassElement()
- isCommentEnumMember()
- isCommentNode()
- isCommentObjectLiteralElement()
- isCommentStatement()
- isCommentTypeElement()
- isComputedPropertyName
- isConditionalExpression
- isConditionalTypeNode()
- isConstructorDeclaration()
- isConstructorTypeNode()
- isConstructSignatureDeclaration()
- isContinueStatement
- isDebuggerStatement
- isDecoratable()
- isDecorator
- isDefaultClause
- isDeleteExpression
- isDoStatement
- isDotDotDotTokenable()
- isElementAccessExpression
- isEmptyStatement
- isEnumDeclaration
- isEnumMember
- isExclamationTokenable()
- isExportable()
- isExportAssignment
- isExportDeclaration
- isExportGetable()
- isExportSpecifier
- isExpression()
- isExpressionable()
- isExpressioned()
- isExpressionStatement
- isExpressionWithTypeArguments
- isExtendsClauseable()
- isExternalModuleReference
- isFalseLiteral()
- isFirstNodeOnLine()
- isForInStatement
- isForOfStatement
- isForStatement
- isFunctionDeclaration
- isFunctionExpression
- isFunctionLikeDeclaration()
- isFunctionTypeNode()
- isGeneratorable()
- isGetAccessorDeclaration()
- isHeritageClause
- isHeritageClauseable()
- isIdentifier
- isIfStatement
- isImplementsClauseable()
- isImportAttribute
- isImportAttributeNamed()
- isImportAttributes
- isImportClause
- isImportDeclaration
- isImportEqualsDeclaration
- isImportExpression()
- isImportSpecifier
- isImportTypeNode()
- isIndexedAccessTypeNode()
- isIndexSignatureDeclaration()
- isInferKeyword
- isInferTypeNode()
- isInitializerExpressionable()
- isInitializerExpressionGetable()
- isInStringAtPos()
- isInSyntaxList()
- isInterfaceDeclaration
- isIntersectionTypeNode()
- isIterationStatement()
- isJSDoc
- isJSDocable()
- isJSDocAllType
- isJSDocAugmentsTag
- isJSDocAuthorTag
- isJSDocCallbackTag
- isJSDocClassTag
- isJSDocDeprecatedTag
- isJSDocEnumTag
- isJSDocFunctionType
- isJSDocImplementsTag
- isJSDocLink
- isJSDocLinkCode
- isJSDocLinkPlain
- isJSDocMemberName
- isJSDocNamepathType
- isJSDocNameReference
- isJSDocNonNullableType
- isJSDocNullableType
- isJSDocOptionalType
- isJSDocOverloadTag
- isJSDocOverrideTag
- isJSDocParameterTag
- isJSDocPrivateTag
- isJSDocPropertyLikeTag()
- isJSDocPropertyTag
- isJSDocProtectedTag
- isJSDocPublicTag
- isJSDocReadonlyTag
- isJSDocReturnTag
- isJSDocSatisfiesTag
- isJSDocSeeTag
- isJSDocSignature
- isJSDocTag()
- isJSDocTemplateTag
- isJSDocText
- isJSDocThisTag
- isJSDocThrowsTag
- isJSDocType()
- isJSDocTypedefTag
- isJSDocTypeExpression
- isJSDocTypeExpressionableTag()
- isJSDocTypeLiteral
- isJSDocTypeParameteredTag()
- isJSDocTypeTag
- isJSDocUnknownTag()
- isJSDocUnknownType
- isJSDocVariadicType
- isJsxAttribute
- isJsxAttributed()
- isJsxClosingElement
- isJsxClosingFragment
- isJsxElement
- isJsxExpression
- isJsxFragment
- isJsxNamespacedName
- isJsxOpeningElement
- isJsxOpeningFragment
- isJsxSelfClosingElement
- isJsxSpreadAttribute
- isJsxTagNamed()
- isJsxText
- isKind()
- isLabeledStatement
- isLeftHandSideExpression()
- isLeftHandSideExpressioned()
- isLiteralExpression()
- isLiteralLike()
- isLiteralTypeNode()
- isMappedTypeNode()
- isMemberExpression()
- isMetaProperty
- isMethodDeclaration
- isMethodSignature
- isModifierable()
- isModuleBlock
- isModuleChildable()
- isModuled()
- isModuleDeclaration
- isModuleNamed()
- isNameable()
- isNamed()
- isNamedExports
- isNamedImports
- isNamedTupleMember
- isNamespaceExport
- isNamespaceImport
- isNeverKeyword
- isNewExpression
- isNode()
- isNodeWithTypeArguments()
- isNonNullExpression
- isNoSubstitutionTemplateLiteral
- isNotEmittedStatement
- isNullLiteral()
- isNumberKeyword
- isNumericLiteral
- isObjectBindingPattern
- isObjectKeyword
- isObjectLiteralExpression
- isOmittedExpression
- isOverloadable()
- isOverrideable()
- isParameterDeclaration()
- isParametered()
- isParenthesizedExpression
- isParenthesizedTypeNode()
- isPartiallyEmittedExpression
- isPostfixUnaryExpression
- isPrefixUnaryExpression
- isPrimaryExpression()
- isPrivateIdentifier
- isPropertyAccessExpression
- isPropertyAssignment
- isPropertyDeclaration
- isPropertyNamed()
- isPropertySignature
- isQualifiedName
- isQuestionDotTokenable()
- isQuestionTokenable()
- isReadonlyable()
- isReferenceFindable()
- isRegularExpressionLiteral
- isRenameable()
- isRestTypeNode()
- isReturnStatement
- isReturnTyped()
- isSatisfiesExpression
- isScopeable()
- isScoped()
- isSemicolonToken
- isSetAccessorDeclaration()
- isShorthandPropertyAssignment
- isSignaturedDeclaration()
- isSourceFile
- isSpreadAssignment
- isSpreadElement
- isStatement()
- isStatemented()
- isStaticable()
- isStringKeyword
- isStringLiteral
- isSuperExpression()
- isSwitchStatement
- isSymbolKeyword
- isSyntaxList
- isTaggedTemplateExpression
- isTemplateExpression
- isTemplateHead
- isTemplateLiteralTypeNode()
- isTemplateMiddle
- isTemplateSpan
- isTemplateTail
- isTextInsertable()
- isThisExpression()
- isThisTypeNode()
- isThrowStatement
- isTrueLiteral()
- isTryStatement
- isTupleTypeNode()
- isTypeAliasDeclaration
- isTypeArgumented()
- isTypeAssertion()
- isTyped()
- isTypeElement()
- isTypeElementMembered()
- isTypeLiteral()
- isTypeNode()
- isTypeOfExpression
- isTypeOperatorTypeNode()
- isTypeParameterDeclaration()
- isTypeParametered()
- isTypePredicate()
- isTypeQuery()
- isTypeReference()
- isUnaryExpression()
- isUnaryExpressioned()
- isUndefinedKeyword
- isUnionTypeNode()
- isUnwrappable()
- isUpdateExpression()
- isVariableDeclaration
- isVariableDeclarationList
- isVariableStatement
- isVoidExpression
- isWhileStatement
- isWithStatement
- isYieldExpression
- prependWhitespace()
- print()
- replaceWithText()
- transform()
- wasForgotten()
ObjectLiteralExpression
- addGetAccessor()
- addGetAccessors()
- addMethod()
- addMethods()
- addProperties()
- addProperty()
- addPropertyAssignment()
- addPropertyAssignments()
- addSetAccessor()
- addSetAccessors()
- addShorthandPropertyAssignment()
- addShorthandPropertyAssignments()
- addSpreadAssignment()
- addSpreadAssignments()
- getParent()
- getParentOrThrow()
- getProperties()
- getPropertiesWithComments()
- getProperty()
- getPropertyOrThrow()
- insertGetAccessor()
- insertGetAccessors()
- insertMethod()
- insertMethods()
- insertProperties()
- insertProperty()
- insertPropertyAssignment()
- insertPropertyAssignments()
- insertSetAccessor()
- insertSetAccessors()
- insertShorthandPropertyAssignment()
- insertShorthandPropertyAssignments()
- insertSpreadAssignment()
- insertSpreadAssignments()
Project
- addDirectoryAtPath()
- addDirectoryAtPathIfExists()
- addSourceFileAtPath()
- addSourceFileAtPathIfExists()
- addSourceFilesAtPaths()
- addSourceFilesFromTsConfig()
- compilerOptions
- createDirectory()
- createSourceFile()
- createWriter()
- emit()
- emitSync()
- emitToMemory()
- enableLogging()
- forgetNodesCreatedInBlock()
- formatDiagnosticsWithColorAndContext()
- getAmbientModule()
- getAmbientModuleOrThrow()
- getAmbientModules()
- getCompilerOptions()
- getConfigFileParsingDiagnostics()
- getDirectories()
- getDirectory()
- getDirectoryOrThrow()
- getFileSystem()
- getLanguageService()
- getModuleResolutionHost()
- getPreEmitDiagnostics()
- getProgram()
- getRootDirectories()
- getSourceFile()
- getSourceFileOrThrow()
- getSourceFiles()
- getTypeChecker()
- manipulationSettings
- removeSourceFile()
- resolveSourceFileDependencies()
- save()
- saveSync()
SourceFile
- applyTextChanges()
- copy()
- copyImmediately()
- copyImmediatelySync()
- copyToDirectory()
- delete()
- deleteImmediately()
- deleteImmediatelySync()
- emit()
- emitSync()
- fixMissingImports()
- fixUnusedIdentifiers()
- formatText()
- getBaseName()
- getBaseNameWithoutExtension()
- getDirectory()
- getDirectoryPath()
- getEmitOutput()
- getExtension()
- getFilePath()
- getFullText()
- getImportStringLiterals()
- getLanguageVariant()
- getLanguageVersion()
- getLengthFromLineStartAtPos()
- getLibReferenceDirectives()
- getLineAndColumnAtPos()
- getLiteralsReferencingOtherSourceFiles()
- getNodesReferencingOtherSourceFiles()
- getParent()
- getParentOrThrow()
- getPathReferenceDirectives()
- getPreEmitDiagnostics()
- getReferencedSourceFiles()
- getReferencingLiteralsInOtherSourceFiles()
- getReferencingNodesInOtherSourceFiles()
- getReferencingSourceFiles()
- getRelativePathAsModuleSpecifierTo()
- getRelativePathTo()
- getScriptKind()
- getStructure()
- getTypeReferenceDirectives()
- indent()
- isDeclarationFile()
- isFromExternalLibrary()
- isInNodeModules()
- isSaved()
- move()
- moveImmediately()
- moveImmediatelySync()
- moveToDirectory()
- onModified()
- organizeImports()
- refreshFromFileSystem()
- refreshFromFileSystemSync()
- save()
- saveSync()
- set()
- unindent()
Symbol
- compilerSymbol
- getAliasedSymbol()
- getAliasedSymbolOrThrow()
- getDeclarations()
- getDeclaredType()
- getEscapedName()
- getExport()
- getExportOrThrow()
- getExports()
- getExportSymbol()
- getFlags()
- getFullyQualifiedName()
- getGlobalExport()
- getGlobalExportOrThrow()
- getGlobalExports()
- getImmediatelyAliasedSymbol()
- getImmediatelyAliasedSymbolOrThrow()
- getJsDocTags()
- getMember()
- getMemberOrThrow()
- getMembers()
- getName()
- getTypeAtLocation()
- getValueDeclaration()
- getValueDeclarationOrThrow()
- hasFlags()
- isAlias()
- isOptional()
Type
- compilerType
- getAliasSymbol()
- getAliasSymbolOrThrow()
- getAliasTypeArguments()
- getApparentProperties()
- getApparentProperty()
- getApparentType()
- getArrayElementType()
- getArrayElementTypeOrThrow()
- getBaseTypeOfLiteralType()
- getBaseTypes()
- getCallSignatures()
- getConstraint()
- getConstraintOrThrow()
- getConstructSignatures()
- getDefault()
- getDefaultOrThrow()
- getFlags()
- getIntersectionTypes()
- getLiteralFreshType()
- getLiteralFreshTypeOrThrow()
- getLiteralRegularType()
- getLiteralRegularTypeOrThrow()
- getLiteralValue()
- getLiteralValueOrThrow()
- getNonNullableType()
- getNumberIndexType()
- getObjectFlags()
- getProperties()
- getProperty()
- getPropertyOrThrow()
- getStringIndexType()
- getSymbol()
- getSymbolOrThrow()
- getTargetType()
- getTargetTypeOrThrow()
- getText()
- getTupleElements()
- getTypeArguments()
- getUnionTypes()
- isAnonymous()
- isAny()
- isArray()
- isAssignableTo()
- isBigInt()
- isBigIntLiteral()
- isBoolean()
- isBooleanLiteral()
- isClass()
- isClassOrInterface()
- isEnum()
- isEnumLiteral()
- isInterface()
- isIntersection()
- isLiteral()
- isNever()
- isNull()
- isNullable()
- isNumber()
- isNumberLiteral()
- isObject()
- isReadonlyArray()
- isString()
- isStringLiteral()
- isTemplateLiteral()
- isTuple()
- isTypeParameter()
- isUndefined()
- isUnion()
- isUnionOrIntersection()
- isUnknown()
- isVoid()
TypeChecker
- compilerObject
- getAliasedSymbol()
- getAmbientModules()
- getApparentType()
- getBaseTypeOfLiteralType()
- getConstantValue()
- getContextualType()
- getDeclaredTypeOfSymbol()
- getExportsOfModule()
- getExportSpecifierLocalTargetSymbol()
- getExportSymbolOfSymbol()
- getFullyQualifiedName()
- getImmediatelyAliasedSymbol()
- getPropertiesOfType()
- getResolvedSignature()
- getResolvedSignatureOrThrow()
- getReturnTypeOfSignature()
- getShorthandAssignmentValueSymbol()
- getSignatureFromNode()
- getSymbolAtLocation()
- getSymbolsInScope()
- getTypeArguments()
- getTypeAtLocation()
- getTypeOfSymbolAtLocation()
- getTypeText()
- isTypeAssignableTo()
- resolveName()
Interfaces
ImplementedKindToNodeMappings
- [SyntaxKind.AnyKeyword]
- [SyntaxKind.ArrayBindingPattern]
- [SyntaxKind.ArrayLiteralExpression]
- [SyntaxKind.ArrayType]
- [SyntaxKind.ArrowFunction]
- [SyntaxKind.AsExpression]
- [SyntaxKind.AwaitExpression]
- [SyntaxKind.BigIntLiteral]
- [SyntaxKind.BinaryExpression]
- [SyntaxKind.BindingElement]
- [SyntaxKind.Block]
- [SyntaxKind.BooleanKeyword]
- [SyntaxKind.BreakStatement]
- [SyntaxKind.CallExpression]
- [SyntaxKind.CallSignature]
- [SyntaxKind.CaseBlock]
- [SyntaxKind.CaseClause]
- [SyntaxKind.CatchClause]
- [SyntaxKind.ClassDeclaration]
- [SyntaxKind.ClassExpression]
- [SyntaxKind.ClassStaticBlockDeclaration]
- [SyntaxKind.CommaListExpression]
- [SyntaxKind.ComputedPropertyName]
- [SyntaxKind.ConditionalExpression]
- [SyntaxKind.ConditionalType]
- [SyntaxKind.Constructor]
- [SyntaxKind.ConstructorType]
- [SyntaxKind.ConstructSignature]
- [SyntaxKind.ContinueStatement]
- [SyntaxKind.DebuggerStatement]
- [SyntaxKind.Decorator]
- [SyntaxKind.DefaultClause]
- [SyntaxKind.DeleteExpression]
- [SyntaxKind.DoStatement]
- [SyntaxKind.ElementAccessExpression]
- [SyntaxKind.EmptyStatement]
- [SyntaxKind.EnumDeclaration]
- [SyntaxKind.EnumMember]
- [SyntaxKind.ExportAssignment]
- [SyntaxKind.ExportDeclaration]
- [SyntaxKind.ExportSpecifier]
- [SyntaxKind.ExpressionStatement]
- [SyntaxKind.ExpressionWithTypeArguments]
- [SyntaxKind.ExternalModuleReference]
- [SyntaxKind.FalseKeyword]
- [SyntaxKind.ForInStatement]
- [SyntaxKind.ForOfStatement]
- [SyntaxKind.ForStatement]
- [SyntaxKind.FunctionDeclaration]
- [SyntaxKind.FunctionExpression]
- [SyntaxKind.FunctionType]
- [SyntaxKind.GetAccessor]
- [SyntaxKind.HeritageClause]
- [SyntaxKind.Identifier]
- [SyntaxKind.IfStatement]
- [SyntaxKind.ImportAttribute]
- [SyntaxKind.ImportAttributes]
- [SyntaxKind.ImportClause]
- [SyntaxKind.ImportDeclaration]
- [SyntaxKind.ImportEqualsDeclaration]
- [SyntaxKind.ImportKeyword]
- [SyntaxKind.ImportSpecifier]
- [SyntaxKind.ImportType]
- [SyntaxKind.IndexedAccessType]
- [SyntaxKind.IndexSignature]
- [SyntaxKind.InferKeyword]
- [SyntaxKind.InferType]
- [SyntaxKind.InterfaceDeclaration]
- [SyntaxKind.IntersectionType]
- [SyntaxKind.JSDoc]
- [SyntaxKind.JSDocAllType]
- [SyntaxKind.JSDocAugmentsTag]
- [SyntaxKind.JSDocAuthorTag]
- [SyntaxKind.JSDocCallbackTag]
- [SyntaxKind.JSDocClassTag]
- [SyntaxKind.JSDocDeprecatedTag]
- [SyntaxKind.JSDocEnumTag]
- [SyntaxKind.JSDocFunctionType]
- [SyntaxKind.JSDocImplementsTag]
- [SyntaxKind.JSDocLink]
- [SyntaxKind.JSDocLinkCode]
- [SyntaxKind.JSDocLinkPlain]
- [SyntaxKind.JSDocMemberName]
- [SyntaxKind.JSDocNamepathType]
- [SyntaxKind.JSDocNameReference]
- [SyntaxKind.JSDocNonNullableType]
- [SyntaxKind.JSDocNullableType]
- [SyntaxKind.JSDocOptionalType]
- [SyntaxKind.JSDocOverloadTag]
- [SyntaxKind.JSDocOverrideTag]
- [SyntaxKind.JSDocParameterTag]
- [SyntaxKind.JSDocPrivateTag]
- [SyntaxKind.JSDocPropertyTag]
- [SyntaxKind.JSDocProtectedTag]
- [SyntaxKind.JSDocPublicTag]
- [SyntaxKind.JSDocReadonlyTag]
- [SyntaxKind.JSDocReturnTag]
- [SyntaxKind.JSDocSatisfiesTag]
- [SyntaxKind.JSDocSeeTag]
- [SyntaxKind.JSDocSignature]
- [SyntaxKind.JSDocTag]
- [SyntaxKind.JSDocTemplateTag]
- [SyntaxKind.JSDocText]
- [SyntaxKind.JSDocThisTag]
- [SyntaxKind.JSDocThrowsTag]
- [SyntaxKind.JSDocTypedefTag]
- [SyntaxKind.JSDocTypeExpression]
- [SyntaxKind.JSDocTypeLiteral]
- [SyntaxKind.JSDocTypeTag]
- [SyntaxKind.JSDocUnknownType]
- [SyntaxKind.JSDocVariadicType]
- [SyntaxKind.JsxAttribute]
- [SyntaxKind.JsxClosingElement]
- [SyntaxKind.JsxClosingFragment]
- [SyntaxKind.JsxElement]
- [SyntaxKind.JsxExpression]
- [SyntaxKind.JsxFragment]
- [SyntaxKind.JsxNamespacedName]
- [SyntaxKind.JsxOpeningElement]
- [SyntaxKind.JsxOpeningFragment]
- [SyntaxKind.JsxSelfClosingElement]
- [SyntaxKind.JsxSpreadAttribute]
- [SyntaxKind.JsxText]
- [SyntaxKind.LabeledStatement]
- [SyntaxKind.LiteralType]
- [SyntaxKind.MappedType]
- [SyntaxKind.MetaProperty]
- [SyntaxKind.MethodDeclaration]
- [SyntaxKind.MethodSignature]
- [SyntaxKind.ModuleBlock]
- [SyntaxKind.ModuleDeclaration]
- [SyntaxKind.NamedExports]
- [SyntaxKind.NamedImports]
- [SyntaxKind.NamedTupleMember]
- [SyntaxKind.NamespaceExport]
- [SyntaxKind.NamespaceImport]
- [SyntaxKind.NeverKeyword]
- [SyntaxKind.NewExpression]
- [SyntaxKind.NonNullExpression]
- [SyntaxKind.NoSubstitutionTemplateLiteral]
- [SyntaxKind.NotEmittedStatement]
- [SyntaxKind.NullKeyword]
- [SyntaxKind.NumberKeyword]
- [SyntaxKind.NumericLiteral]
- [SyntaxKind.ObjectBindingPattern]
- [SyntaxKind.ObjectKeyword]
- [SyntaxKind.ObjectLiteralExpression]
- [SyntaxKind.OmittedExpression]
- [SyntaxKind.Parameter]
- [SyntaxKind.ParenthesizedExpression]
- [SyntaxKind.ParenthesizedType]
- [SyntaxKind.PartiallyEmittedExpression]
- [SyntaxKind.PostfixUnaryExpression]
- [SyntaxKind.PrefixUnaryExpression]
- [SyntaxKind.PrivateIdentifier]
- [SyntaxKind.PropertyAccessExpression]
- [SyntaxKind.PropertyAssignment]
- [SyntaxKind.PropertyDeclaration]
- [SyntaxKind.PropertySignature]
- [SyntaxKind.QualifiedName]
- [SyntaxKind.RegularExpressionLiteral]
- [SyntaxKind.RestType]
- [SyntaxKind.ReturnStatement]
- [SyntaxKind.SatisfiesExpression]
- [SyntaxKind.SemicolonToken]
- [SyntaxKind.SetAccessor]
- [SyntaxKind.ShorthandPropertyAssignment]
- [SyntaxKind.SourceFile]
- [SyntaxKind.SpreadAssignment]
- [SyntaxKind.SpreadElement]
- [SyntaxKind.StringKeyword]
- [SyntaxKind.StringLiteral]
- [SyntaxKind.SuperKeyword]
- [SyntaxKind.SwitchStatement]
- [SyntaxKind.SymbolKeyword]
- [SyntaxKind.SyntaxList]
- [SyntaxKind.TaggedTemplateExpression]
- [SyntaxKind.TemplateExpression]
- [SyntaxKind.TemplateHead]
- [SyntaxKind.TemplateLiteralType]
- [SyntaxKind.TemplateMiddle]
- [SyntaxKind.TemplateSpan]
- [SyntaxKind.TemplateTail]
- [SyntaxKind.ThisKeyword]
- [SyntaxKind.ThisType]
- [SyntaxKind.ThrowStatement]
- [SyntaxKind.TrueKeyword]
- [SyntaxKind.TryStatement]
- [SyntaxKind.TupleType]
- [SyntaxKind.TypeAliasDeclaration]
- [SyntaxKind.TypeAssertionExpression]
- [SyntaxKind.TypeLiteral]
- [SyntaxKind.TypeOfExpression]
- [SyntaxKind.TypeOperator]
- [SyntaxKind.TypeParameter]
- [SyntaxKind.TypePredicate]
- [SyntaxKind.TypeQuery]
- [SyntaxKind.TypeReference]
- [SyntaxKind.UndefinedKeyword]
- [SyntaxKind.UnionType]
- [SyntaxKind.VariableDeclaration]
- [SyntaxKind.VariableDeclarationList]
- [SyntaxKind.VariableStatement]
- [SyntaxKind.VoidExpression]
- [SyntaxKind.WhileStatement]
- [SyntaxKind.WithStatement]
- [SyntaxKind.YieldExpression]
KindToExpressionMappings
- [SyntaxKind.AnyKeyword]
- [SyntaxKind.ArrayLiteralExpression]
- [SyntaxKind.ArrowFunction]
- [SyntaxKind.AsExpression]
- [SyntaxKind.AwaitExpression]
- [SyntaxKind.BigIntLiteral]
- [SyntaxKind.BinaryExpression]
- [SyntaxKind.BooleanKeyword]
- [SyntaxKind.CallExpression]
- [SyntaxKind.ClassExpression]
- [SyntaxKind.CommaListExpression]
- [SyntaxKind.ConditionalExpression]
- [SyntaxKind.DeleteExpression]
- [SyntaxKind.ElementAccessExpression]
- [SyntaxKind.FalseKeyword]
- [SyntaxKind.FunctionExpression]
- [SyntaxKind.Identifier]
- [SyntaxKind.ImportKeyword]
- [SyntaxKind.JsxClosingFragment]
- [SyntaxKind.JsxElement]
- [SyntaxKind.JsxExpression]
- [SyntaxKind.JsxFragment]
- [SyntaxKind.JsxOpeningElement]
- [SyntaxKind.JsxOpeningFragment]
- [SyntaxKind.JsxSelfClosingElement]
- [SyntaxKind.MetaProperty]
- [SyntaxKind.NewExpression]
- [SyntaxKind.NonNullExpression]
- [SyntaxKind.NoSubstitutionTemplateLiteral]
- [SyntaxKind.NullKeyword]
- [SyntaxKind.NumberKeyword]
- [SyntaxKind.NumericLiteral]
- [SyntaxKind.ObjectKeyword]
- [SyntaxKind.ObjectLiteralExpression]
- [SyntaxKind.OmittedExpression]
- [SyntaxKind.ParenthesizedExpression]
- [SyntaxKind.PartiallyEmittedExpression]
- [SyntaxKind.PostfixUnaryExpression]
- [SyntaxKind.PrefixUnaryExpression]
- [SyntaxKind.PropertyAccessExpression]
- [SyntaxKind.RegularExpressionLiteral]
- [SyntaxKind.SatisfiesExpression]
- [SyntaxKind.SpreadElement]
- [SyntaxKind.StringKeyword]
- [SyntaxKind.StringLiteral]
- [SyntaxKind.SuperKeyword]
- [SyntaxKind.SymbolKeyword]
- [SyntaxKind.TaggedTemplateExpression]
- [SyntaxKind.TemplateExpression]
- [SyntaxKind.ThisKeyword]
- [SyntaxKind.TrueKeyword]
- [SyntaxKind.TypeAssertionExpression]
- [SyntaxKind.TypeOfExpression]
- [SyntaxKind.UndefinedKeyword]
- [SyntaxKind.VoidExpression]
- [SyntaxKind.YieldExpression]
ModuledNode
- addExportAssignment()
- addExportAssignments()
- addExportDeclaration()
- addExportDeclarations()
- addImportDeclaration()
- addImportDeclarations()
- getDefaultExportSymbol()
- getDefaultExportSymbolOrThrow()
- getExportAssignment()
- getExportAssignmentOrThrow()
- getExportAssignments()
- getExportDeclaration()
- getExportDeclarationOrThrow()
- getExportDeclarations()
- getExportedDeclarations()
- getExportSymbols()
- getImportDeclaration()
- getImportDeclarationOrThrow()
- getImportDeclarations()
- insertExportAssignment()
- insertExportAssignments()
- insertExportDeclaration()
- insertExportDeclarations()
- insertImportDeclaration()
- insertImportDeclarations()
- removeDefaultExport()
StatementedNode
- addClass()
- addClasses()
- addEnum()
- addEnums()
- addFunction()
- addFunctions()
- addInterface()
- addInterfaces()
- addModule()
- addModules()
- addStatements()
- addTypeAlias()
- addTypeAliases()
- addVariableStatement()
- addVariableStatements()
- getClass()
- getClasses()
- getClassOrThrow()
- getEnum()
- getEnumOrThrow()
- getEnums()
- getFunction()
- getFunctionOrThrow()
- getFunctions()
- getInterface()
- getInterfaceOrThrow()
- getInterfaces()
- getModule()
- getModuleOrThrow()
- getModules()
- getStatement()
- getStatementByKind()
- getStatementByKindOrThrow()
- getStatementOrThrow()
- getStatements()
- getStatementsWithComments()
- getTypeAlias()
- getTypeAliases()
- getTypeAliasOrThrow()
- getVariableDeclaration()
- getVariableDeclarationOrThrow()
- getVariableDeclarations()
- getVariableStatement()
- getVariableStatementOrThrow()
- getVariableStatements()
- insertClass()
- insertClasses()
- insertEnum()
- insertEnums()
- insertFunction()
- insertFunctions()
- insertInterface()
- insertInterfaces()
- insertModule()
- insertModules()
- insertStatements()
- insertTypeAlias()
- insertTypeAliases()
- insertVariableStatement()
- insertVariableStatements()
- removeStatement()
- removeStatements()
TypeElementMemberedNode
- addCallSignature()
- addCallSignatures()
- addConstructSignature()
- addConstructSignatures()
- addGetAccessor()
- addGetAccessors()
- addIndexSignature()
- addIndexSignatures()
- addMember()
- addMembers()
- addMethod()
- addMethods()
- addProperties()
- addProperty()
- addSetAccessor()
- addSetAccessors()
- getCallSignature()
- getCallSignatureOrThrow()
- getCallSignatures()
- getConstructSignature()
- getConstructSignatureOrThrow()
- getConstructSignatures()
- getGetAccessor()
- getGetAccessorOrThrow()
- getGetAccessors()
- getIndexSignature()
- getIndexSignatureOrThrow()
- getIndexSignatures()
- getMembers()
- getMembersWithComments()
- getMethod()
- getMethodOrThrow()
- getMethods()
- getProperties()
- getProperty()
- getPropertyOrThrow()
- getSetAccessor()
- getSetAccessorOrThrow()
- getSetAccessors()
- insertCallSignature()
- insertCallSignatures()
- insertConstructSignature()
- insertConstructSignatures()
- insertGetAccessor()
- insertGetAccessors()
- insertIndexSignature()
- insertIndexSignatures()
- insertMember()
- insertMembers()
- insertMethod()
- insertMethods()
- insertProperties()
- insertProperty()
- insertSetAccessor()
- insertSetAccessors()
Enums
StructureKind
- CallSignature
- Class
- ClassStaticBlock
- Constructor
- ConstructorOverload
- ConstructSignature
- Decorator
- Enum
- EnumMember
- ExportAssignment
- ExportDeclaration
- ExportSpecifier
- Function
- FunctionOverload
- GetAccessor
- ImportAttribute
- ImportDeclaration
- ImportSpecifier
- IndexSignature
- Interface
- JSDoc
- JSDocTag
- JsxAttribute
- JsxElement
- JsxSelfClosingElement
- JsxSpreadAttribute
- Method
- MethodOverload
- MethodSignature
- Module
- Parameter
- Property
- PropertyAssignment
- PropertySignature
- SetAccessor
- ShorthandPropertyAssignment
- SourceFile
- SpreadAssignment
- TypeAlias
- TypeParameter
- VariableDeclaration
- VariableStatement
Type Aliases
- AccessorDeclaration
- ArrayBindingElement
- AssertionKey
- BindingName
- BindingNamedNodeSpecific
- BindingPattern
- BooleanLiteral
- CallLikeExpression
- CaseOrDefaultClause
- ClassInstanceMemberTypes
- ClassInstancePropertyTypes
- ClassMemberStructures
- ClassMemberTypes
- ClassPropertyTypes
- ClassStaticMemberTypes
- ClassStaticPropertyTypes
- CompilerNodeToWrappedType
- Constructor
- DeclarationName
- EntityName
- EntityNameExpression
- ExportedDeclarations
- ImportAttributeNamedNodeSpecific
- InstanceOf
- InterfaceMemberStructures
- JsxAttributeLike
- JsxAttributeName
- JsxCallLike
- JsxChild
- JsxOpeningLikeElement
- JsxStructures
- JsxTagNameExpression
- LocalTargetDeclarations
- ModifierTexts
- ModuleName
- ModuleNamedNodeSpecific
- ModuleReference
- NamedNodeSpecific
- NodeParentType
- NodePropertyToWrappedType
- ObjectLiteralElementLike
- ObjectLiteralExpressionPropertyStructures
- OptionalKind
- PropertyName
- PropertyNamedNodeSpecific
- ResolutionHostFactory
- SourceFileReferencingNodes
- StatementStructures
- StringLiteralLike
- Structures
- TemplateLiteral
- TypeElementMemberStructures
- TypeElementTypes
- WriterFunction
- WriterFunctionOrValue
Variables
variable ArgumentError
const ArgumentError: any;
variable ArgumentNullOrWhitespaceError
const ArgumentNullOrWhitespaceError: any;
variable ArgumentOutOfRangeError
const ArgumentOutOfRangeError: any;
variable ArgumentTypeError
const ArgumentTypeError: any;
variable ArrayDestructuringAssignmentBase
const ArrayDestructuringAssignmentBase: typeof AssignmentExpression;
variable ArrowFunctionBase
const ArrowFunctionBase: Constructor<TextInsertableNode> & Constructor<BodiedNode> & Constructor<AsyncableNode> & Constructor<FunctionLikeDeclaration> & typeof Expression;
variable AsExpressionBase
const AsExpressionBase: Constructor<TypedNode> & Constructor<ExpressionedNode> & typeof Expression;
variable AssignmentExpressionBase
const AssignmentExpressionBase: typeof BinaryExpression;
variable AwaitExpressionBase
const AwaitExpressionBase: Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
variable BaseError
const BaseError: any;
variable BigIntLiteralBase
const BigIntLiteralBase: typeof LiteralExpression;
variable BinaryExpressionBase
const BinaryExpressionBase: typeof Expression;
variable BindingElementBase
const BindingElementBase: Constructor<DotDotDotTokenableNode> & Constructor<InitializerExpressionableNode> & Constructor<BindingNamedNode> & typeof Node;
variable BlockBase
const BlockBase: Constructor<TextInsertableNode> & Constructor<StatementedNode> & typeof Statement;
variable CallExpressionBase
const CallExpressionBase: Constructor<TypeArgumentedNode> & Constructor<ArgumentedNode> & Constructor<QuestionDotTokenableNode> & Constructor<LeftHandSideExpressionedNode> & typeof LeftHandSideExpression;
variable CallSignatureDeclarationBase
const CallSignatureDeclarationBase: Constructor<TypeParameteredNode> & Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<SignaturedDeclaration> & typeof TypeElement;
variable CaseBlockBase
const CaseBlockBase: Constructor<TextInsertableNode> & typeof Node;
variable CaseClauseBase
const CaseClauseBase: Constructor<JSDocableNode> & Constructor<ExpressionedNode> & Constructor<TextInsertableNode> & Constructor<StatementedNode> & typeof Node;
variable CatchClauseBase
const CatchClauseBase: typeof Node;
variable ClassDeclarationBase
const ClassDeclarationBase: Constructor<ModuleChildableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ClassLikeDeclarationBase> & typeof Statement;
variable ClassExpressionBase
const ClassExpressionBase: Constructor<ClassLikeDeclarationBase> & typeof PrimaryExpression;
variable ClassStaticBlockDeclarationBase
const ClassStaticBlockDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<StatementedNode> & Constructor<JSDocableNode> & Constructor<BodiedNode> & typeof ClassElement;
variable CommaListExpressionBase
const CommaListExpressionBase: typeof Expression;
variable ComputedPropertyNameBase
const ComputedPropertyNameBase: Constructor<ExpressionedNode> & typeof Node;
variable ConditionalExpressionBase
const ConditionalExpressionBase: typeof Expression;
variable ConstructorDeclarationBase
const ConstructorDeclarationBase: Constructor<ReferenceFindableNode> & Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<OverloadableNode> & Constructor<ScopedNode> & Constructor<FunctionLikeDeclaration> & Constructor<BodyableNode> & typeof ClassElement;
variable ConstructorDeclarationOverloadBase
const ConstructorDeclarationOverloadBase: Constructor<TypeParameteredNode> & Constructor<JSDocableNode> & Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<ScopedNode> & Constructor<ModifierableNode> & Constructor<SignaturedDeclaration> & typeof ClassElement;
variable ConstructorTypeNodeBase
const ConstructorTypeNodeBase: Constructor<AbstractableNode> & Constructor<ModifierableNode> & typeof FunctionOrConstructorTypeNodeBase;
variable ConstructSignatureDeclarationBase
const ConstructSignatureDeclarationBase: Constructor<TypeParameteredNode> & Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<SignaturedDeclaration> & typeof TypeElement;
variable DebuggerStatementBase
const DebuggerStatementBase: typeof Statement;
variable DecoratorBase
const DecoratorBase: Constructor<LeftHandSideExpressionedNode> & typeof Node;
variable DefaultClauseBase
const DefaultClauseBase: Constructor<TextInsertableNode> & Constructor<StatementedNode> & typeof Node;
variable DeleteExpressionBase
const DeleteExpressionBase: Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
variable DirectoryNotFoundError
const DirectoryNotFoundError: any;
variable DoStatementBase
const DoStatementBase: Constructor<ExpressionedNode> & typeof IterationStatement;
variable ElementAccessExpressionBase
const ElementAccessExpressionBase: Constructor<QuestionDotTokenableNode> & Constructor<LeftHandSideExpressionedNode> & typeof MemberExpression;
variable EmptyStatementBase
const EmptyStatementBase: typeof Statement;
variable EnumDeclarationBase
const EnumDeclarationBase: Constructor<TextInsertableNode> & Constructor<ModuleChildableNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<NamedNode> & typeof Statement;
variable EnumMemberBase
const EnumMemberBase: Constructor<JSDocableNode> & Constructor<InitializerExpressionableNode> & Constructor<PropertyNamedNode> & typeof Node;
variable ExportAssignmentBase
const ExportAssignmentBase: Constructor<ExpressionedNode> & Constructor<JSDocableNode> & typeof Statement;
variable ExportDeclarationBase
const ExportDeclarationBase: typeof Statement;
variable ExportSpecifierBase
const ExportSpecifierBase: typeof Node;
variable ExpressionStatementBase
const ExpressionStatementBase: Constructor<ExpressionedNode> & Constructor<JSDocableNode> & typeof Statement;
variable ExpressionWithTypeArgumentsBase
const ExpressionWithTypeArgumentsBase: Constructor<LeftHandSideExpressionedNode> & typeof NodeWithTypeArguments;
variable ExternalModuleReferenceBase
const ExternalModuleReferenceBase: Constructor<ExpressionableNode> & typeof Node;
variable FalseLiteralBase
const FalseLiteralBase: typeof PrimaryExpression;
variable FileNotFoundError
const FileNotFoundError: any;
variable ForInStatementBase
const ForInStatementBase: Constructor<ExpressionedNode> & typeof IterationStatement;
variable ForOfStatementBase
const ForOfStatementBase: Constructor<ExpressionedNode> & Constructor<AwaitableNode> & typeof IterationStatement;
variable ForStatementBase
const ForStatementBase: typeof IterationStatement;
variable FunctionDeclarationBase
const FunctionDeclarationBase: Constructor<UnwrappableNode> & Constructor<TextInsertableNode> & Constructor<OverloadableNode> & Constructor<BodyableNode> & Constructor<AsyncableNode> & Constructor<GeneratorableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<FunctionLikeDeclaration> & Constructor<ModuleChildableNode> & Constructor<NameableNode> & typeof Statement;
variable FunctionDeclarationOverloadBase
const FunctionDeclarationOverloadBase: Constructor<UnwrappableNode> & Constructor<TextInsertableNode> & Constructor<AsyncableNode> & Constructor<GeneratorableNode> & Constructor<SignaturedDeclaration> & Constructor<AmbientableNode> & Constructor<ModuleChildableNode> & Constructor<JSDocableNode> & Constructor<TypeParameteredNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & typeof Statement;
variable FunctionExpressionBase
const FunctionExpressionBase: Constructor<JSDocableNode> & Constructor<TextInsertableNode> & Constructor<BodiedNode> & Constructor<AsyncableNode> & Constructor<GeneratorableNode> & Constructor<StatementedNode> & Constructor<TypeParameteredNode> & Constructor<SignaturedDeclaration> & Constructor<ModifierableNode> & Constructor<NameableNode> & typeof PrimaryExpression;
variable FunctionOrConstructorTypeNodeBaseBase
const FunctionOrConstructorTypeNodeBaseBase: Constructor<SignaturedDeclaration> & typeof TypeNode;
variable FunctionTypeNodeBase
const FunctionTypeNodeBase: Constructor<TypeParameteredNode> & typeof FunctionOrConstructorTypeNodeBase;
variable GetAccessorDeclarationBase
const GetAccessorDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<DecoratableNode> & Constructor<AbstractableNode> & Constructor<ScopedNode> & Constructor<StaticableNode> & Constructor<FunctionLikeDeclaration> & Constructor<BodyableNode> & Constructor<PropertyNamedNode> & typeof ClassElement;
variable IdentifierBase
const IdentifierBase: Constructor<CommonIdentifierBase> & Constructor<ReferenceFindableNode> & Constructor<RenameableNode> & typeof PrimaryExpression;
variable IfStatementBase
const IfStatementBase: Constructor<ExpressionedNode> & typeof Statement;
variable ImportAttributeBase
const ImportAttributeBase: Constructor<ImportAttributeNamedNode> & typeof Node;
variable ImportAttributesBase
const ImportAttributesBase: typeof Node;
variable ImportClauseBase
const ImportClauseBase: typeof Node;
variable ImportDeclarationBase
const ImportDeclarationBase: typeof Statement;
variable ImportEqualsDeclarationBase
const ImportEqualsDeclarationBase: Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<JSDocableNode> & Constructor<NamedNode> & typeof Statement;
variable ImportExpressionBase
const ImportExpressionBase: typeof PrimaryExpression;
variable ImportSpecifierBase
const ImportSpecifierBase: typeof Node;
variable IndexSignatureDeclarationBase
const IndexSignatureDeclarationBase: Constructor<ReturnTypedNode> & Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<ReadonlyableNode> & Constructor<ModifierableNode> & typeof TypeElement;
variable InterfaceDeclarationBase
const InterfaceDeclarationBase: Constructor<TypeElementMemberedNode> & Constructor<TextInsertableNode> & Constructor<ExtendsClauseableNode> & Constructor<HeritageClauseableNode> & Constructor<TypeParameteredNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<ModuleChildableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<NamedNode> & typeof Statement;
variable InvalidOperationError
const InvalidOperationError: any;
variable JSDocBase
const JSDocBase: typeof Node;
variable JSDocFunctionTypeBase
const JSDocFunctionTypeBase: Constructor<SignaturedDeclaration> & typeof JSDocType;
variable JSDocOverloadTagBase
const JSDocOverloadTagBase: Constructor<JSDocTypeExpressionableTag> & typeof JSDocTag;
variable JSDocParameterTagBase
const JSDocParameterTagBase: Constructor<JSDocPropertyLikeTag> & typeof JSDocTag;
variable JSDocPropertyTagBase
const JSDocPropertyTagBase: Constructor<JSDocPropertyLikeTag> & typeof JSDocTag;
variable JSDocReturnTagBase
const JSDocReturnTagBase: Constructor<JSDocTypeExpressionableTag> & typeof JSDocTag;
variable JSDocSatisfiesTagBase
const JSDocSatisfiesTagBase: Constructor<JSDocTypeExpressionableTag> & typeof JSDocTag;
variable JSDocSeeTagBase
const JSDocSeeTagBase: Constructor<JSDocTypeExpressionableTag> & typeof JSDocTag;
variable JSDocTagBase
const JSDocTagBase: typeof Node;
variable JSDocTemplateTagBase
const JSDocTemplateTagBase: Constructor<JSDocTypeParameteredTag> & typeof JSDocTag;
variable JSDocThisTagBase
const JSDocThisTagBase: Constructor<JSDocTypeExpressionableTag> & typeof JSDocTag;
variable JSDocThrowsTagBase
const JSDocThrowsTagBase: Constructor<JSDocTypeExpressionableTag> & typeof JSDocTag;
variable JsxAttributeBase
const JsxAttributeBase: typeof Node;
variable JsxClosingElementBase
const JsxClosingElementBase: Constructor<JsxTagNamedNode> & typeof Node;
variable JsxElementBase
const JsxElementBase: typeof PrimaryExpression;
variable JsxExpressionBase
const JsxExpressionBase: Constructor<ExpressionableNode> & Constructor<DotDotDotTokenableNode> & typeof Expression;
variable JsxNamespacedNameBase
const JsxNamespacedNameBase: typeof Node;
variable JsxOpeningElementBase
const JsxOpeningElementBase: Constructor<JsxAttributedNode> & Constructor<JsxTagNamedNode> & typeof Expression;
variable JsxSelfClosingElementBase
const JsxSelfClosingElementBase: Constructor<JsxAttributedNode> & Constructor<JsxTagNamedNode> & typeof PrimaryExpression;
variable JsxSpreadAttributeBase
const JsxSpreadAttributeBase: Constructor<ExpressionedNode> & typeof Node;
variable JsxTextBase
const JsxTextBase: Constructor<LiteralLikeNode> & typeof Node;
variable LabeledStatementBase
const LabeledStatementBase: Constructor<JSDocableNode> & typeof Statement;
variable LiteralExpressionBase
const LiteralExpressionBase: Constructor<LiteralLikeNode> & typeof PrimaryExpression;
variable MetaPropertyBase
const MetaPropertyBase: Constructor<NamedNode> & typeof PrimaryExpression;
variable MethodDeclarationBase
const MethodDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<OverrideableNode> & Constructor<OverloadableNode> & Constructor<BodyableNode> & Constructor<DecoratableNode> & Constructor<AbstractableNode> & Constructor<ScopedNode> & Constructor<QuestionTokenableNode> & Constructor<StaticableNode> & Constructor<AsyncableNode> & Constructor<GeneratorableNode> & Constructor<FunctionLikeDeclaration> & Constructor<PropertyNamedNode> & typeof ClassElement;
variable MethodDeclarationOverloadBase
const MethodDeclarationOverloadBase: Constructor<JSDocableNode> & Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<OverrideableNode> & Constructor<ScopedNode> & Constructor<TypeParameteredNode> & Constructor<AbstractableNode> & Constructor<QuestionTokenableNode> & Constructor<StaticableNode> & Constructor<AsyncableNode> & Constructor<ModifierableNode> & Constructor<GeneratorableNode> & Constructor<SignaturedDeclaration> & typeof ClassElement;
variable MethodSignatureBase
const MethodSignatureBase: Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<QuestionTokenableNode> & Constructor<TypeParameteredNode> & Constructor<SignaturedDeclaration> & Constructor<PropertyNamedNode> & typeof TypeElement;
variable ModuleBlockBase
const ModuleBlockBase: Constructor<StatementedNode> & typeof Statement;
variable ModuleDeclarationBase
const ModuleDeclarationBase: Constructor<ModuledNode> & Constructor<UnwrappableNode> & Constructor<TextInsertableNode> & Constructor<BodyableNode> & Constructor<ModuleChildableNode> & Constructor<StatementedNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<ModuleNamedNode> & typeof Statement;
variable NamedExportsBase
const NamedExportsBase: typeof Node;
variable NamedImportsBase
const NamedImportsBase: typeof Node;
variable NamedTupleMemberBase
const NamedTupleMemberBase: Constructor<TypedNode> & Constructor<QuestionTokenableNode> & Constructor<DotDotDotTokenableNode> & Constructor<JSDocableNode> & Constructor<NamedNode> & typeof TypeNode;
variable NamespaceExportBase
const NamespaceExportBase: Constructor<RenameableNode> & typeof Node;
variable NamespaceImportBase
const NamespaceImportBase: Constructor<RenameableNode> & typeof Node;
variable NewExpressionBase
const NewExpressionBase: Constructor<TypeArgumentedNode> & Constructor<ArgumentedNode> & Constructor<LeftHandSideExpressionedNode> & typeof PrimaryExpression;
variable NodeWithTypeArgumentsBase
const NodeWithTypeArgumentsBase: Constructor<TypeArgumentedNode> & typeof TypeNode;
variable NonNullExpressionBase
const NonNullExpressionBase: Constructor<ExpressionedNode> & typeof LeftHandSideExpression;
variable NoSubstitutionTemplateLiteralBase
const NoSubstitutionTemplateLiteralBase: typeof LiteralExpression;
variable NotEmittedStatementBase
const NotEmittedStatementBase: typeof Statement;
variable NotImplementedError
const NotImplementedError: any;
variable NotSupportedError
const NotSupportedError: any;
variable NullLiteralBase
const NullLiteralBase: typeof PrimaryExpression;
variable NumericLiteralBase
const NumericLiteralBase: typeof LiteralExpression;
variable ObjectDestructuringAssignmentBase
const ObjectDestructuringAssignmentBase: typeof AssignmentExpression;
variable ObjectLiteralExpressionBase
const ObjectLiteralExpressionBase: typeof PrimaryExpression;
variable OmittedExpressionBase
const OmittedExpressionBase: typeof Expression;
variable ParameterDeclarationBase
const ParameterDeclarationBase: Constructor<OverrideableNode> & Constructor<QuestionTokenableNode> & Constructor<DecoratableNode> & Constructor<ScopeableNode> & Constructor<ReadonlyableNode> & Constructor<ModifierableNode> & Constructor<DotDotDotTokenableNode> & Constructor<TypedNode> & Constructor<InitializerExpressionableNode> & Constructor<BindingNamedNode> & typeof Node;
variable ParenthesizedExpressionBase
const ParenthesizedExpressionBase: Constructor<ExpressionedNode> & typeof Expression;
variable PartiallyEmittedExpressionBase
const PartiallyEmittedExpressionBase: Constructor<ExpressionedNode> & typeof Expression;
variable PathNotFoundError
const PathNotFoundError: any;
variable PostfixUnaryExpressionBase
const PostfixUnaryExpressionBase: typeof UnaryExpression;
variable PrefixUnaryExpressionBase
const PrefixUnaryExpressionBase: typeof UnaryExpression;
variable PrivateIdentifierBase
const PrivateIdentifierBase: Constructor<CommonIdentifierBase> & Constructor<ReferenceFindableNode> & Constructor<RenameableNode> & typeof Node;
variable PropertyAccessExpressionBase
const PropertyAccessExpressionBase: Constructor<NamedNode> & Constructor<QuestionDotTokenableNode> & Constructor<LeftHandSideExpressionedNode> & typeof MemberExpression;
variable PropertyAssignmentBase
const PropertyAssignmentBase: Constructor<InitializerExpressionGetableNode> & Constructor<QuestionTokenableNode> & Constructor<PropertyNamedNode> & typeof ObjectLiteralElement;
variable PropertyDeclarationBase
const PropertyDeclarationBase: Constructor<ChildOrderableNode> & Constructor<OverrideableNode> & Constructor<AmbientableNode> & Constructor<DecoratableNode> & Constructor<AbstractableNode> & Constructor<ScopedNode> & Constructor<StaticableNode> & Constructor<JSDocableNode> & Constructor<ReadonlyableNode> & Constructor<ExclamationTokenableNode> & Constructor<QuestionTokenableNode> & Constructor<InitializerExpressionableNode> & Constructor<TypedNode> & Constructor<PropertyNamedNode> & Constructor<ModifierableNode> & typeof ClassElement;
variable PropertySignatureBase
const PropertySignatureBase: Constructor<ChildOrderableNode> & Constructor<JSDocableNode> & Constructor<ReadonlyableNode> & Constructor<QuestionTokenableNode> & Constructor<InitializerExpressionableNode> & Constructor<TypedNode> & Constructor<PropertyNamedNode> & Constructor<ModifierableNode> & typeof TypeElement;
variable RegularExpressionLiteralBase
const RegularExpressionLiteralBase: typeof LiteralExpression;
variable ResolutionHosts
const ResolutionHosts: { deno: ResolutionHostFactory };
Collection of reusable resolution hosts.
variable ReturnStatementBase
const ReturnStatementBase: Constructor<ExpressionableNode> & typeof Statement;
variable SatisfiesExpressionBase
const SatisfiesExpressionBase: Constructor<TypedNode> & Constructor<ExpressionedNode> & typeof Expression;
variable SetAccessorDeclarationBase
const SetAccessorDeclarationBase: Constructor<ChildOrderableNode> & Constructor<TextInsertableNode> & Constructor<DecoratableNode> & Constructor<AbstractableNode> & Constructor<ScopedNode> & Constructor<StaticableNode> & Constructor<FunctionLikeDeclaration> & Constructor<BodyableNode> & Constructor<PropertyNamedNode> & typeof ClassElement;
variable ShorthandPropertyAssignmentBase
const ShorthandPropertyAssignmentBase: Constructor<InitializerExpressionGetableNode> & Constructor<QuestionTokenableNode> & Constructor<NamedNode> & typeof ObjectLiteralElement;
variable SourceFileBase
const SourceFileBase: Constructor<ModuledNode> & Constructor<StatementedNode> & Constructor<TextInsertableNode> & typeof Node;
variable SpreadAssignmentBase
const SpreadAssignmentBase: Constructor<ExpressionedNode> & typeof ObjectLiteralElement;
variable SpreadElementBase
const SpreadElementBase: Constructor<ExpressionedNode> & typeof Expression;
variable StatementBase
const StatementBase: Constructor<ChildOrderableNode> & typeof Node;
variable StringLiteralBase
const StringLiteralBase: typeof LiteralExpression;
variable Structure
const Structure: { readonly hasName: <T extends Structure>( structure: T ) => structure is T & { name: string }; readonly isCallSignature: ( structure: unknown ) => structure is CallSignatureDeclarationStructure; readonly isJSDocable: <T_1>( structure: T_1 ) => structure is T_1 & JSDocableNodeStructure; readonly isSignatured: <T_2>( structure: T_2 ) => structure is T_2 & SignaturedDeclarationStructure; readonly isParametered: <T_3>( structure: T_3 ) => structure is T_3 & ParameteredNodeStructure; readonly isReturnTyped: <T_4>( structure: T_4 ) => structure is T_4 & ReturnTypedNodeStructure; readonly isTypeParametered: <T_5>( structure: T_5 ) => structure is T_5 & TypeParameteredNodeStructure; readonly isClass: (structure: unknown) => structure is ClassDeclarationStructure; readonly isClassLikeDeclarationBase: <T_6>( structure: T_6 ) => structure is T_6 & ClassLikeDeclarationBaseStructure; readonly isNameable: <T_7>( structure: T_7 ) => structure is T_7 & NameableNodeStructure; readonly isImplementsClauseable: <T_8>( structure: T_8 ) => structure is T_8 & ImplementsClauseableNodeStructure; readonly isDecoratable: <T_9>( structure: T_9 ) => structure is T_9 & DecoratableNodeStructure; readonly isAbstractable: <T_10>( structure: T_10 ) => structure is T_10 & AbstractableNodeStructure; readonly isAmbientable: <T_11>( structure: T_11 ) => structure is T_11 & AmbientableNodeStructure; readonly isExportable: <T_12>( structure: T_12 ) => structure is T_12 & ExportableNodeStructure; readonly isClassStaticBlock: ( structure: unknown ) => structure is ClassStaticBlockDeclarationStructure; readonly isStatemented: <T_13>( structure: T_13 ) => structure is T_13 & StatementedNodeStructure; readonly isConstructorDeclarationOverload: ( structure: unknown ) => structure is ConstructorDeclarationOverloadStructure; readonly isScoped: <T_14>( structure: T_14 ) => structure is T_14 & ScopedNodeStructure; readonly isConstructor: ( structure: unknown ) => structure is ConstructorDeclarationStructure; readonly isFunctionLike: <T_15>( structure: T_15 ) => structure is T_15 & FunctionLikeDeclarationStructure; readonly isConstructSignature: ( structure: unknown ) => structure is ConstructSignatureDeclarationStructure; readonly isDecorator: (structure: unknown) => structure is DecoratorStructure; readonly isEnum: (structure: unknown) => structure is EnumDeclarationStructure; readonly isNamed: <T_16>( structure: T_16 ) => structure is T_16 & NamedNodeStructure; readonly isEnumMember: (structure: unknown) => structure is EnumMemberStructure; readonly isPropertyNamed: <T_17>( structure: T_17 ) => structure is T_17 & PropertyNamedNodeStructure; readonly isInitializerExpressionable: <T_18>( structure: T_18 ) => structure is T_18 & InitializerExpressionableNodeStructure; readonly isExportAssignment: ( structure: unknown ) => structure is ExportAssignmentStructure; readonly isExportDeclaration: ( structure: unknown ) => structure is ExportDeclarationStructure; readonly isExportSpecifier: ( structure: unknown ) => structure is ExportSpecifierStructure; readonly isFunctionDeclarationOverload: ( structure: unknown ) => structure is FunctionDeclarationOverloadStructure; readonly isAsyncable: <T_19>( structure: T_19 ) => structure is T_19 & AsyncableNodeStructure; readonly isGeneratorable: <T_20>( structure: T_20 ) => structure is T_20 & GeneratorableNodeStructure; readonly isFunction: ( structure: unknown ) => structure is FunctionDeclarationStructure; readonly isGetAccessor: ( structure: unknown ) => structure is GetAccessorDeclarationStructure; readonly isStaticable: <T_21>( structure: T_21 ) => structure is T_21 & StaticableNodeStructure; readonly isImportAttribute: ( structure: unknown ) => structure is ImportAttributeStructure; readonly isImportAttributeNamed: <T_22>( structure: T_22 ) => structure is T_22 & ImportAttributeNamedNodeStructure; readonly isImportDeclaration: ( structure: unknown ) => structure is ImportDeclarationStructure; readonly isImportSpecifier: ( structure: unknown ) => structure is ImportSpecifierStructure; readonly isIndexSignature: ( structure: unknown ) => structure is IndexSignatureDeclarationStructure; readonly isReadonlyable: <T_23>( structure: T_23 ) => structure is T_23 & ReadonlyableNodeStructure; readonly isInterface: ( structure: unknown ) => structure is InterfaceDeclarationStructure; readonly isExtendsClauseable: <T_24>( structure: T_24 ) => structure is T_24 & ExtendsClauseableNodeStructure; readonly isTypeElementMembered: <T_25>( structure: T_25 ) => structure is T_25 & TypeElementMemberedNodeStructure; readonly isJSDoc: (structure: unknown) => structure is JSDocStructure; readonly isJSDocTag: (structure: unknown) => structure is JSDocTagStructure; readonly isJsxAttribute: ( structure: unknown ) => structure is JsxAttributeStructure; readonly isJsxElement: (structure: unknown) => structure is JsxElementStructure; readonly isJsxSelfClosingElement: ( structure: unknown ) => structure is JsxSelfClosingElementStructure; readonly isJsxTagNamed: <T_26>( structure: T_26 ) => structure is T_26 & JsxTagNamedNodeStructure; readonly isJsxAttributed: <T_27>( structure: T_27 ) => structure is T_27 & JsxAttributedNodeStructure; readonly isJsxSpreadAttribute: ( structure: unknown ) => structure is JsxSpreadAttributeStructure; readonly isMethodDeclarationOverload: ( structure: unknown ) => structure is MethodDeclarationOverloadStructure; readonly isQuestionTokenable: <T_28>( structure: T_28 ) => structure is T_28 & QuestionTokenableNodeStructure; readonly isOverrideable: <T_29>( structure: T_29 ) => structure is T_29 & OverrideableNodeStructure; readonly isMethod: ( structure: unknown ) => structure is MethodDeclarationStructure; readonly isMethodSignature: ( structure: unknown ) => structure is MethodSignatureStructure; readonly isModule: ( structure: unknown ) => structure is ModuleDeclarationStructure; readonly isModuleNamed: <T_30>( structure: T_30 ) => structure is T_30 & ModuleNamedNodeStructure; readonly isParameter: ( structure: unknown ) => structure is ParameterDeclarationStructure; readonly isBindingNamed: <T_31>( structure: T_31 ) => structure is T_31 & BindingNamedNodeStructure; readonly isTyped: <T_32>( structure: T_32 ) => structure is T_32 & TypedNodeStructure; readonly isScopeable: <T_33>( structure: T_33 ) => structure is T_33 & ScopeableNodeStructure; readonly isPropertyAssignment: ( structure: unknown ) => structure is PropertyAssignmentStructure; readonly isProperty: ( structure: unknown ) => structure is PropertyDeclarationStructure; readonly isExclamationTokenable: <T_34>( structure: T_34 ) => structure is T_34 & ExclamationTokenableNodeStructure; readonly isPropertySignature: ( structure: unknown ) => structure is PropertySignatureStructure; readonly isSetAccessor: ( structure: unknown ) => structure is SetAccessorDeclarationStructure; readonly isShorthandPropertyAssignment: ( structure: unknown ) => structure is ShorthandPropertyAssignmentStructure; readonly isSourceFile: (structure: unknown) => structure is SourceFileStructure; readonly isSpreadAssignment: ( structure: unknown ) => structure is SpreadAssignmentStructure; readonly isExpressioned: <T_35>( structure: T_35 ) => structure is T_35 & ExpressionedNodeStructure; readonly isTypeAlias: ( structure: unknown ) => structure is TypeAliasDeclarationStructure; readonly isTypeParameter: ( structure: unknown ) => structure is TypeParameterDeclarationStructure; readonly isVariableDeclaration: ( structure: unknown ) => structure is VariableDeclarationStructure; readonly isVariableStatement: ( structure: unknown ) => structure is VariableStatementStructure;};
Type guards for use on structures.
variable SuperElementAccessExpressionBase
const SuperElementAccessExpressionBase: Constructor<SuperExpressionedNode> & typeof ElementAccessExpression;
variable SuperExpressionBase
const SuperExpressionBase: typeof PrimaryExpression;
variable SuperPropertyAccessExpressionBase
const SuperPropertyAccessExpressionBase: Constructor<SuperExpressionedNode> & typeof PropertyAccessExpression;
variable SwitchStatementBase
const SwitchStatementBase: Constructor<ExpressionedNode> & typeof Statement;
variable TemplateExpressionBase
const TemplateExpressionBase: typeof PrimaryExpression;
variable TemplateHeadBase
const TemplateHeadBase: Constructor<LiteralLikeNode> & typeof Node;
variable TemplateMiddleBase
const TemplateMiddleBase: Constructor<LiteralLikeNode> & typeof Node;
variable TemplateSpanBase
const TemplateSpanBase: Constructor<ExpressionedNode> & typeof Node;
variable TemplateTailBase
const TemplateTailBase: Constructor<LiteralLikeNode> & typeof Node;
variable ThisExpressionBase
const ThisExpressionBase: typeof PrimaryExpression;
variable ThrowStatementBase
const ThrowStatementBase: Constructor<ExpressionedNode> & typeof Statement;
variable TrueLiteralBase
const TrueLiteralBase: typeof PrimaryExpression;
variable TryStatementBase
const TryStatementBase: typeof Statement;
variable TypeAliasDeclarationBase
const TypeAliasDeclarationBase: Constructor<TypeParameteredNode> & Constructor<TypedNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & Constructor<NamedNode> & typeof Statement;
variable TypeAssertionBase
const TypeAssertionBase: Constructor<TypedNode> & Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
variable TypeLiteralNodeBase
const TypeLiteralNodeBase: Constructor<TypeElementMemberedNode> & typeof TypeNode;
variable TypeOfExpressionBase
const TypeOfExpressionBase: Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
variable TypeParameterDeclarationBase
const TypeParameterDeclarationBase: Constructor<ModifierableNode> & Constructor<NamedNode> & typeof Node;
variable VariableDeclarationBase
const VariableDeclarationBase: Constructor<ExportGetableNode> & Constructor<ExclamationTokenableNode> & Constructor<TypedNode> & Constructor<InitializerExpressionableNode> & Constructor<BindingNamedNode> & typeof Node;
variable VariableDeclarationListBase
const VariableDeclarationListBase: Constructor<ModifierableNode> & typeof Node;
variable VariableStatementBase
const VariableStatementBase: Constructor<ModuleChildableNode> & Constructor<JSDocableNode> & Constructor<AmbientableNode> & Constructor<ExportableNode> & Constructor<ModifierableNode> & typeof Statement;
variable VoidExpressionBase
const VoidExpressionBase: Constructor<UnaryExpressionedNode> & typeof UnaryExpression;
variable WhileStatementBase
const WhileStatementBase: Constructor<ExpressionedNode> & typeof IterationStatement;
variable WithStatementBase
const WithStatementBase: Constructor<ExpressionedNode> & typeof Statement;
variable YieldExpressionBase
const YieldExpressionBase: Constructor<ExpressionableNode> & Constructor<GeneratorableNode> & typeof Expression;
Functions
function AbstractableNode
AbstractableNode: <T extends Constructor<AbstractableNodeExtensionType>>( Base: T) => Constructor<AbstractableNode> & T;
function AmbientableNode
AmbientableNode: <T extends Constructor<AmbientableNodeExtensionType>>( Base: T) => Constructor<AmbientableNode> & T;
function ArgumentedNode
ArgumentedNode: <T extends Constructor<ArgumentedNodeExtensionType>>( Base: T) => Constructor<ArgumentedNode> & T;
function AsyncableNode
AsyncableNode: <T extends Constructor<AsyncableNodeExtensionType>>( Base: T) => Constructor<AsyncableNode> & T;
function AwaitableNode
AwaitableNode: <T extends Constructor<AwaitableNodeExtensionType>>( Base: T) => Constructor<AwaitableNode> & T;
function BaseExpressionedNode
BaseExpressionedNode: < T extends Constructor<ExpressionedNodeExtensionType>, TExpression extends Node<ts.Node> = CompilerNodeToWrappedType< InstanceOf<T>['compilerNode'] >>( Base: T) => Constructor<BaseExpressionedNode<TExpression>> & T;
function BindingNamedNode
BindingNamedNode: <T extends Constructor<BindingNamedNodeExtensionType>>( Base: T) => Constructor<BindingNamedNode> & T;
function BodiedNode
BodiedNode: <T extends Constructor<BodiedNodeExtensionType>>( Base: T) => Constructor<BodiedNode> & T;
function BodyableNode
BodyableNode: <T extends Constructor<BodyableNodeExtensionType>>( Base: T) => Constructor<BodyableNode> & T;
function ChildOrderableNode
ChildOrderableNode: <T extends Constructor<ChildOrderableNodeExtensionType>>( Base: T) => Constructor<ChildOrderableNode> & T;
function ClassLikeDeclarationBase
ClassLikeDeclarationBase: < T extends Constructor<ClassLikeDeclarationBaseExtensionType>>( Base: T) => Constructor<ClassLikeDeclarationBase> & T;
function ClassLikeDeclarationBaseSpecific
ClassLikeDeclarationBaseSpecific: < T extends Constructor<ClassLikeDeclarationBaseSpecificExtensionType>>( Base: T) => Constructor<ClassLikeDeclarationBaseSpecific> & T;
function CommonIdentifierBase
CommonIdentifierBase: <T extends Constructor<CommonIdentifierBaseExtensionType>>( Base: T) => Constructor<CommonIdentifierBase> & T;
function createWrappedNode
createWrappedNode: <T extends ts.Node = ts.Node>( node: T, opts?: CreateWrappedNodeOptions) => CompilerNodeToWrappedType<T>;
Creates a wrapped node from a compiler node.
Parameter node
Node to create a wrapped node from.
Parameter info
Info for creating the wrapped node.
function DecoratableNode
DecoratableNode: <T extends Constructor<DecoratableNodeExtensionType>>( Base: T) => Constructor<DecoratableNode> & T;
function DotDotDotTokenableNode
DotDotDotTokenableNode: < T extends Constructor<DotDotDotTokenableNodeExtensionType>>( Base: T) => Constructor<DotDotDotTokenableNode> & T;
function ExclamationTokenableNode
ExclamationTokenableNode: < T extends Constructor<ExclamationTokenableNodeExtensionType>>( Base: T) => Constructor<ExclamationTokenableNode> & T;
function ExportableNode
ExportableNode: <T extends Constructor<ExportableNodeExtensionType>>( Base: T) => Constructor<ExportableNode> & T;
function ExportGetableNode
ExportGetableNode: <T extends Constructor<ExportGetableNodeExtensionType>>( Base: T) => Constructor<ExportGetableNode> & T;
function ExpressionableNode
ExpressionableNode: <T extends Constructor<ExpressionableNodeExtensionType>>( Base: T) => Constructor<ExpressionableNode> & T;
function ExpressionedNode
ExpressionedNode: <T extends Constructor<ExpressionedNodeExtensionType>>( Base: T) => Constructor<ExpressionedNode> & T;
function ExtendsClauseableNode
ExtendsClauseableNode: < T extends Constructor<ExtendsClauseableNodeExtensionType>>( Base: T) => Constructor<ExtendsClauseableNode> & T;
function forEachStructureChild
forEachStructureChild: { <TStructure>( structures: ReadonlyArray<Structures>, callback: (child: Structures) => TStructure | void ): TStructure | undefined; <TStructure>( structure: Structures, callback: (child: Structures) => void | TStructure ): TStructure;};
Iterates over the elements in the provided array.
Parameter structures
Array of structures to iterate over.
Parameter callback
Callback to do on each element in the array. Returning a truthy value will return that value in the main function call.
Iterates over the children of the provided array.
Parameter structure
Structure to iterate over.
Parameter callback
Callback to do on each child of the provided structure. Returning a truthy value will return that value in the main function call.
Remarks
If the children do not have a
kind
property, it will be automatically added.
function FunctionLikeDeclaration
FunctionLikeDeclaration: < T extends Constructor<FunctionLikeDeclarationExtensionType>>( Base: T) => Constructor<FunctionLikeDeclaration> & T;
function GeneratorableNode
GeneratorableNode: <T extends Constructor<GeneratorableNodeExtensionType>>( Base: T) => Constructor<GeneratorableNode> & T;
function getCompilerOptionsFromTsConfig
getCompilerOptionsFromTsConfig: ( filePath: string, options?: CompilerOptionsFromTsConfigOptions) => CompilerOptionsFromTsConfigResult;
Gets the compiler options from a specified tsconfig.json
Parameter filePath
File path to the tsconfig.json.
Parameter options
Options.
function HeritageClauseableNode
HeritageClauseableNode: < T extends Constructor<HeritageClauseableNodeExtensionType>>( Base: T) => Constructor<HeritageClauseableNode> & T;
function ImplementsClauseableNode
ImplementsClauseableNode: < T extends Constructor<ImplementsClauseableNodeExtensionType>>( Base: T) => Constructor<ImplementsClauseableNode> & T;
function ImportAttributeNamedNode
ImportAttributeNamedNode: < T extends Constructor<ImportAttributeNamedNodeExtensionType>>( Base: T) => Constructor<ImportAttributeNamedNode> & T;
function ImportExpressionedNode
ImportExpressionedNode: < T extends Constructor<ImportExpressionedNodeExtensionType>>( Base: T) => Constructor<ImportExpressionedNode> & T;
function InitializerExpressionableNode
InitializerExpressionableNode: < T extends Constructor<InitializerExpressionableNodeExtensionType>>( Base: T) => Constructor<InitializerExpressionableNode> & T;
function InitializerExpressionGetableNode
InitializerExpressionGetableNode: < T extends Constructor<InitializerExpressionGetableNodeExtensionType>>( Base: T) => Constructor<InitializerExpressionGetableNode> & T;
function JSDocableNode
JSDocableNode: <T extends Constructor<JSDocableNodeExtensionType>>( Base: T) => Constructor<JSDocableNode> & T;
function JSDocPropertyLikeTag
JSDocPropertyLikeTag: <T extends Constructor<JSDocPropertyLikeTagExtensionType>>( Base: T) => Constructor<JSDocPropertyLikeTag> & T;
function JSDocTypeExpressionableTag
JSDocTypeExpressionableTag: < T extends Constructor<JSDocTypeExpressionableTagExtensionType>>( Base: T) => Constructor<JSDocTypeExpressionableTag> & T;
function JSDocTypeParameteredTag
JSDocTypeParameteredTag: < T extends Constructor<JSDocTypeParameteredTagExtensionType>>( Base: T) => Constructor<JSDocTypeParameteredTag> & T;
function JsxAttributedNode
JsxAttributedNode: <T extends Constructor<JsxAttributedNodeExtensionType>>( Base: T) => Constructor<JsxAttributedNode> & T;
function JsxTagNamedNode
JsxTagNamedNode: <T extends Constructor<JsxTagNamedNodeExtensionType>>( Base: T) => Constructor<JsxTagNamedNode> & T;
function LeftHandSideExpressionedNode
LeftHandSideExpressionedNode: < T extends Constructor<LeftHandSideExpressionedNodeExtensionType>>( Base: T) => Constructor<LeftHandSideExpressionedNode> & T;
function LiteralLikeNode
LiteralLikeNode: <T extends Constructor<LiteralLikeNodeExtensionType>>( Base: T) => Constructor<LiteralLikeNode> & T;
function ModifierableNode
ModifierableNode: <T extends Constructor<ModifierableNodeExtensionType>>( Base: T) => Constructor<ModifierableNode> & T;
function ModuleChildableNode
ModuleChildableNode: <T extends Constructor<ModuleChildableNodeExtensionType>>( Base: T) => Constructor<ModuleChildableNode> & T;
function ModuledNode
ModuledNode: <T extends Constructor<ModuledNodeExtensionType>>( Base: T) => Constructor<ModuledNode> & T;
function ModuleNamedNode
ModuleNamedNode: <T extends Constructor<ModuleNamedNodeExtensionType>>( Base: T) => Constructor<ModuleNamedNode> & T;
function NameableNode
NameableNode: <T extends Constructor<NameableNodeExtensionType>>( Base: T) => Constructor<NameableNode> & T;
function NamedNode
NamedNode: <T extends Constructor<NamedNodeExtensionType>>( Base: T) => Constructor<NamedNode> & T;
function NamedNodeBase
NamedNodeBase: < TCompilerNode extends ts.Node, U extends Constructor<NamedNodeBaseExtensionType<TCompilerNode>>>( Base: U) => Constructor<NamedNodeSpecificBase<CompilerNodeToWrappedType<TCompilerNode>>> & U;
function OverloadableNode
OverloadableNode: <T extends Constructor<OverloadableNodeExtensionType>>( Base: T) => Constructor<OverloadableNode> & T;
function OverrideableNode
OverrideableNode: <T extends Constructor<OverrideableNodeExtensionType>>( Base: T) => Constructor<OverrideableNode> & T;
function ParameteredNode
ParameteredNode: <T extends Constructor<ParameteredNodeExtensionType>>( Base: T) => Constructor<ParameteredNode> & T;
function printNode
printNode: { (node: ts.Node, options?: PrintNodeOptions): string; (node: ts.Node, sourceFile: ts.SourceFile, options?: PrintNodeOptions): string;};
Prints the provided node using the compiler's printer.
Parameter node
Compiler node.
Parameter options
Options.
Remarks
If the node was not constructed with the compiler API factory methods and the node does not have parents set, then use the other overload that accepts a source file.
Prints the provided node using the compiler's printer.
Parameter node
Compiler node.
Parameter sourceFile
Compiler source file.
Parameter options
Options.
function PropertyNamedNode
PropertyNamedNode: <T extends Constructor<PropertyNamedNodeExtensionType>>( Base: T) => Constructor<PropertyNamedNode> & T;
function QuestionDotTokenableNode
QuestionDotTokenableNode: < T extends Constructor<QuestionDotTokenableNodeExtensionType>>( Base: T) => Constructor<QuestionDotTokenableNode> & T;
function QuestionTokenableNode
QuestionTokenableNode: < T extends Constructor<QuestionTokenableNodeExtensionType>>( Base: T) => Constructor<QuestionTokenableNode> & T;
function ReadonlyableNode
ReadonlyableNode: <T extends Constructor<ReadonlyableNodeExtensionType>>( Base: T) => Constructor<ReadonlyableNode> & T;
function ReferenceFindableNode
ReferenceFindableNode: < T extends Constructor<ReferenceFindableNodeExtensionType>>( Base: T) => Constructor<ReferenceFindableNode> & T;
function RenameableNode
RenameableNode: <T extends Constructor<RenameableNodeExtensionType>>( Base: T) => Constructor<RenameableNode> & T;
function ReturnTypedNode
ReturnTypedNode: <T extends Constructor<ReturnTypedNodeExtensionType>>( Base: T) => Constructor<ReturnTypedNode> & T;
function ScopeableNode
ScopeableNode: <T extends Constructor<ScopeableNodeExtensionType>>( Base: T) => Constructor<ScopeableNode> & T;
function ScopedNode
ScopedNode: <T extends Constructor<ScopedNodeExtensionType>>( Base: T) => Constructor<ScopedNode> & T;
function SignaturedDeclaration
SignaturedDeclaration: < T extends Constructor<SignaturedDeclarationExtensionType>>( Base: T) => Constructor<SignaturedDeclaration> & T;
function StatementedNode
StatementedNode: <T extends Constructor<StatementedNodeExtensionType>>( Base: T) => Constructor<StatementedNode> & T;
function StaticableNode
StaticableNode: <T extends Constructor<StaticableNodeExtensionType>>( Base: T) => Constructor<StaticableNode> & T;
function SuperExpressionedNode
SuperExpressionedNode: < T extends Constructor<SuperExpressionedNodeExtensionType>>( Base: T) => Constructor<SuperExpressionedNode> & T;
function TextInsertableNode
TextInsertableNode: <T extends Constructor<TextInsertableNodeExtensionType>>( Base: T) => Constructor<TextInsertableNode> & T;
function TypeArgumentedNode
TypeArgumentedNode: <T extends Constructor<TypeArgumentedNodeExtensionType>>( Base: T) => Constructor<TypeArgumentedNode> & T;
function TypedNode
TypedNode: <T extends Constructor<TypedNodeExtensionType>>( Base: T) => Constructor<TypedNode> & T;
function TypeElementMemberedNode
TypeElementMemberedNode: < T extends Constructor<TypeElementMemberedNodeExtensionType>>( Base: T) => Constructor<TypeElementMemberedNode> & T;
function TypeParameteredNode
TypeParameteredNode: <T extends Constructor<TypeParameteredNodeExtensionType>>( Base: T) => Constructor<TypeParameteredNode> & T;
function UnaryExpressionedNode
UnaryExpressionedNode: < T extends Constructor<UnaryExpressionedNodeExtensionType>>( Base: T) => Constructor<UnaryExpressionedNode> & T;
function UnwrappableNode
UnwrappableNode: <T extends Constructor<UnwrappableNodeExtensionType>>( Base: T) => Constructor<UnwrappableNode> & T;
Classes
class ArrayBindingPattern
class ArrayBindingPattern extends Node<ts.ArrayBindingPattern> {}
method getElements
getElements: () => (BindingElement | OmittedExpression)[];
Gets the array binding pattern's elements.
method getParent
getParent: () => NodeParentType<ts.ArrayBindingPattern>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ArrayBindingPattern>>;
*
class ArrayDestructuringAssignment
class ArrayDestructuringAssignment extends ArrayDestructuringAssignmentBase<ts.ArrayDestructuringAssignment> {}
method getLeft
getLeft: () => ArrayLiteralExpression;
Gets the left array literal expression of the array destructuring assignment.
method getParent
getParent: () => NodeParentType<ts.ArrayDestructuringAssignment>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ArrayDestructuringAssignment>>;
*
class ArrayLiteralExpression
class ArrayLiteralExpression extends PrimaryExpression<ts.ArrayLiteralExpression> {}
method addElement
addElement: ( textOrWriterFunction: string | WriterFunction, options?: { useNewLines?: boolean }) => Expression<ts.Expression>;
Adds an element to the array.
Parameter textOrWriterFunction
Text to add as an element.
Parameter options
Options.
method addElements
addElements: ( textsOrWriterFunction: | ReadonlyArray<string | WriterFunction> | WriterFunction, options?: { useNewLines?: boolean }) => Expression<ts.Expression>[];
Adds elements to the array.
Parameter textsOrWriterFunction
Texts to add as elements.
Parameter options
Options.
method getElements
getElements: () => Expression[];
Gets the array's elements.
method getParent
getParent: () => NodeParentType<ts.ArrayLiteralExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ArrayLiteralExpression>>;
*
method insertElement
insertElement: ( index: number, textOrWriterFunction: string | WriterFunction, options?: { useNewLines?: boolean }) => Expression<ts.Expression>;
Insert an element into the array.
Parameter index
Child index to insert at.
Parameter text
Text to insert as an element.
Parameter options
Options.
method insertElements
insertElements: ( index: number, textsOrWriterFunction: | ReadonlyArray<string | WriterFunction> | WriterFunction, options?: { useNewLines?: boolean }) => Expression<ts.Expression>[];
Insert elements into the array.
Parameter index
Child index to insert at.
Parameter textsOrWriterFunction
Texts to insert as elements.
Parameter options
Options.
method removeElement
removeElement: { (index: number): void; (element: Expression<ts.Expression>): void;};
Removes an element from the array.
Parameter index
Index to remove from.
Removes an element from the array.
Parameter element
Element to remove.
class ArrayTypeNode
class ArrayTypeNode extends TypeNode<ts.ArrayTypeNode> {}
method getElementTypeNode
getElementTypeNode: () => TypeNode;
Gets the array type node's element type node.
method getParent
getParent: () => NodeParentType<ts.ArrayTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ArrayTypeNode>>;
*
class ArrowFunction
class ArrowFunction extends ArrowFunctionBase<ts.ArrowFunction> {}
method getEqualsGreaterThan
getEqualsGreaterThan: () => Node<ts.Token<SyntaxKind.EqualsGreaterThanToken>>;
Gets the equals greater than token of the arrow function.
method getParent
getParent: () => NodeParentType<ts.ArrowFunction>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ArrowFunction>>;
*
class AsExpression
class AsExpression extends AsExpressionBase<ts.AsExpression> {}
method getParent
getParent: () => NodeParentType<ts.AsExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.AsExpression>>;
*
class AssignmentExpression
class AssignmentExpression< T extends ts.AssignmentExpression<ts.AssignmentOperatorToken> = ts.AssignmentExpression<ts.AssignmentOperatorToken>> extends AssignmentExpressionBase<T> {}
method getOperatorToken
getOperatorToken: () => Node<ts.AssignmentOperatorToken>;
Gets the operator token of the assignment expression.
class AwaitExpression
class AwaitExpression extends AwaitExpressionBase<ts.AwaitExpression> {}
method getParent
getParent: () => NodeParentType<ts.AwaitExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.AwaitExpression>>;
*
class BigIntLiteral
class BigIntLiteral extends BigIntLiteralBase<ts.BigIntLiteral> {}
method getLiteralValue
getLiteralValue: () => unknown;
Gets the BigInt literal value.
Assert this as a
bigint
in environments that support it.
method getParent
getParent: () => NodeParentType<ts.BigIntLiteral>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.BigIntLiteral>>;
*
method setLiteralValue
setLiteralValue: (value: unknown) => this;
Sets the bigint literal value.
Parameter value
Value to set (must provide a bigint here at runtime).
class BinaryExpression
class BinaryExpression< T extends ts.BinaryExpression = ts.BinaryExpression> extends BinaryExpressionBase<T> {}
method getLeft
getLeft: () => Expression;
Gets the left side of the binary expression.
method getOperatorToken
getOperatorToken: () => Node<ts.BinaryOperatorToken>;
Gets the operator token of the binary expression.
method getRight
getRight: () => Expression;
Gets the right side of the binary expression.
class BindingElement
class BindingElement extends BindingElementBase<ts.BindingElement> {}
method getParent
getParent: () => NodeParentType<ts.BindingElement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.BindingElement>>;
*
method getPropertyNameNode
getPropertyNameNode: () => PropertyName | undefined;
Gets binding element's property name node or returns undefined if not found.
For example in
const { a: b } = { a: 5 }
,a
would be the property name.
method getPropertyNameNodeOrThrow
getPropertyNameNodeOrThrow: (message?: string | (() => string)) => PropertyName;
Gets binding element's property name node or throws if not found.
For example in
const { a: b } = { a: 5 }
,a
would be the property name.
class Block
class Block extends BlockBase<ts.Block> {}
method getParent
getParent: () => NodeParentType<ts.Block>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.Block>>;
*
class BreakStatement
class BreakStatement extends Statement<ts.BreakStatement> {}
method getLabel
getLabel: () => Identifier | undefined;
Gets this break statement's label or undefined if it does not exist.
method getLabelOrThrow
getLabelOrThrow: (message?: string | (() => string)) => Identifier;
Gets this break statement's label or throw if it does not exist.
method getParent
getParent: () => NodeParentType<ts.BreakStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.BreakStatement>>;
*
class CallExpression
class CallExpression< T extends ts.CallExpression = ts.CallExpression> extends CallExpressionBase<T> {}
method getReturnType
getReturnType: () => Type;
Gets the return type of the call expression.
class CallSignatureDeclaration
class CallSignatureDeclaration extends CallSignatureDeclarationBase<ts.CallSignatureDeclaration> {}
method getParent
getParent: () => NodeParentType<ts.CallSignatureDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.CallSignatureDeclaration>>;
*
method getStructure
getStructure: () => CallSignatureDeclarationStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<CallSignatureDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class CaseBlock
class CaseBlock extends CaseBlockBase<ts.CaseBlock> {}
method getClauses
getClauses: () => CaseOrDefaultClause[];
Gets the clauses.
method getParent
getParent: () => NodeParentType<ts.CaseBlock>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.CaseBlock>>;
*
method removeClause
removeClause: (index: number) => this;
Removes the clause at the specified index.
Parameter index
Index.
method removeClauses
removeClauses: (indexRange: [number, number]) => this;
Removes the clauses in the specified range.
Parameter indexRange
Index range.
class CaseClause
class CaseClause extends CaseClauseBase<ts.CaseClause> {}
method getParent
getParent: () => NodeParentType<ts.CaseClause>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.CaseClause>>;
*
method remove
remove: () => void;
Removes this case clause.
class CatchClause
class CatchClause extends CatchClauseBase<ts.CatchClause> {}
method getBlock
getBlock: () => Block;
Gets this catch clause's block.
method getParent
getParent: () => NodeParentType<ts.CatchClause>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.CatchClause>>;
*
method getVariableDeclaration
getVariableDeclaration: () => VariableDeclaration | undefined;
Gets this catch clause's variable declaration or undefined if none exists.
method getVariableDeclarationOrThrow
getVariableDeclarationOrThrow: ( message?: string | (() => string)) => VariableDeclaration;
Gets this catch clause's variable declaration or throws if none exists.
class ClassDeclaration
class ClassDeclaration extends ClassDeclarationBase<ts.ClassDeclaration> {}
method extractInterface
extractInterface: (name?: string) => InterfaceDeclarationStructure;
Extracts an interface declaration structure from the class.
Parameter name
Name of the interface. Falls back to the same name as the class and then the filepath's base name.
method extractStaticInterface
extractStaticInterface: (name: string) => InterfaceDeclarationStructure;
Extracts an interface declaration structure from the static part of the class.
Parameter name
Name of the interface.
method getParent
getParent: () => NodeParentType<ts.ClassDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ClassDeclaration>>;
*
method getStructure
getStructure: () => ClassDeclarationStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<ClassDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class ClassElement
class ClassElement<T extends ts.ClassElement = ts.ClassElement> extends Node<T> {}
method remove
remove: () => void;
Removes the class member.
class ClassExpression
class ClassExpression extends ClassExpressionBase<ts.ClassExpression> {}
method getParent
getParent: () => NodeParentType<ts.ClassExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ClassExpression>>;
*
class ClassStaticBlockDeclaration
class ClassStaticBlockDeclaration extends ClassStaticBlockDeclarationBase<ts.ClassStaticBlockDeclaration> {}
method getName
getName: () => 'static';
Method that exists for the sake of making code compile that looks for the name of static members. This always returns "static".
method getParent
getParent: () => NodeParentType<ts.ClassStaticBlockDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ClassStaticBlockDeclaration>>;
*
method getStructure
getStructure: () => ClassStaticBlockDeclarationStructure;
Gets the structure equivalent to this node.
method isStatic
isStatic: () => true;
Method that exists for the sake of making code compile that looks for this method on class members. This always returns true.
method set
set: (structure: Partial<ClassStaticBlockDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class CodeAction
class CodeAction<TCompilerObject extends ts.CodeAction = ts.CodeAction> {}
Represents a code action.
constructor
protected constructor();
property compilerObject
readonly compilerObject: ts.CodeAction;
Gets the compiler object.
method getChanges
getChanges: () => FileTextChanges[];
Text changes to apply to each file as part of the code action.
method getDescription
getDescription: () => string;
Description of the code action.
class CodeBlockWriter
class CodeBlockWriter {}
Code writer that assists with formatting and visualizing blocks of JavaScript or TypeScript code.
constructor
constructor(opts?: Partial<CodeBlockWriterOptions>);
Constructor.
Parameter opts
Options for the writer.
method blankLine
blankLine: () => this;
Writes a blank line.
method blankLineIfLastNot
blankLineIfLastNot: () => this;
Writes a blank line if the last written text was not a blank line.
method block
block: (block?: () => void) => this;
Writes a block using braces.
Parameter block
Write using the writer within this block.
method closeComment
closeComment: () => this;
Writes text to exit a comment if in a comment.
method conditionalBlankLine
conditionalBlankLine: (condition: boolean | undefined) => this;
Writes a blank line if the condition is true.
Parameter condition
Condition to evaluate.
method conditionalNewLine
conditionalNewLine: (condition: boolean | undefined) => this;
Writes a newline if the condition is true.
Parameter condition
Condition to evaluate.
method conditionalWrite
conditionalWrite: { (condition: boolean | undefined, textFunc: () => string): this; (condition: boolean, text: string): this;};
Conditionally writes text.
Parameter condition
Condition to evaluate.
Parameter textFunc
A function that returns a string to write if the condition is true.
Conditionally writes text.
Parameter condition
Condition to evaluate.
Parameter text
Text to write if the condition is true.
method conditionalWriteLine
conditionalWriteLine: { (condition: boolean | undefined, textFunc: () => string): this; (condition: boolean, text: string): this;};
Conditionally writes a line of text.
Parameter condition
Condition to evaluate.
Parameter textFunc
A function that returns a string to write if the condition is true.
Conditionally writes a line of text.
Parameter condition
Condition to evaluate.
Parameter text
Text to write if the condition is true.
method endsWith
endsWith: (text: string) => boolean;
Gets if the writer ends with the provided text.
Parameter text
Text to check if the writer ends with the provided text.
method getIndentationLevel
getIndentationLevel: () => number;
Gets the current indentation level.
method getLastChar
getLastChar: () => string | undefined;
Gets the last char written.
method getLength
getLength: () => number;
Gets the length of the string in the writer.
method getOptions
getOptions: () => CodeBlockWriterOptions;
Gets the options.
method hangingIndent
hangingIndent: (action: () => void) => this;
Writes the text within the provided action with hanging indentation.
Parameter action
Action to perform with hanging indentation.
method hangingIndentUnlessBlock
hangingIndentUnlessBlock: (action: () => void) => this;
Writes the text within the provided action with hanging indentation unless writing a block.
Parameter action
Action to perform with hanging indentation unless a block is written.
method indent
indent: { (times?: number): this; (block: () => void): this };
Indents the code one level for the current line.
Indents a block of code.
Parameter block
Block to indent.
method inlineBlock
inlineBlock: (block?: () => void) => this;
Writes an inline block with braces.
Parameter block
Write using the writer within this block.
method isAtStartOfFirstLineOfBlock
isAtStartOfFirstLineOfBlock: () => boolean;
Gets if the writer is currently at the start of the first line of the text, block, or indentation block.
method isInComment
isInComment: () => boolean;
Gets if the writer is currently in a comment.
method isInString
isInString: () => boolean;
Gets if the writer is currently in a string.
method isLastBlankLine
isLastBlankLine: () => boolean;
Gets if the last chars written were for a blank line.
method isLastNewLine
isLastNewLine: () => boolean;
Gets if the last chars written were for a newline.
method isLastSpace
isLastSpace: () => boolean;
Gets if the last char written was a space.
method isLastTab
isLastTab: () => boolean;
Gets if the last char written was a tab.
method isOnFirstLineOfBlock
isOnFirstLineOfBlock: () => boolean;
Gets if the writer is currently on the first line of the text, block, or indentation block.
method iterateLastCharCodes
iterateLastCharCodes: <T>( action: (charCode: number, index: number) => T | undefined) => T | undefined;
Iterates over the writer character char codes in reverse order. The iteration stops when a non-null or undefined value is returned from the action. The returned value is then returned by the method.
Remarks
It is much more efficient to use this method rather than
#toString()
since#toString()
will combine the internal array into a string. Additionally, this is slightly more efficient thatiterateLastChars
as this won't allocate a string per character.
method iterateLastChars
iterateLastChars: <T>( action: (char: string, index: number) => T | undefined) => T | undefined;
Iterates over the writer characters in reverse order. The iteration stops when a non-null or undefined value is returned from the action. The returned value is then returned by the method.
Remarks
It is much more efficient to use this method rather than
#toString()
since#toString()
will combine the internal array into a string.
method newLine
newLine: () => this;
Writes a newline.
method newLineIfLastNot
newLineIfLastNot: () => this;
Writes a newline if the last line was not a newline.
method queueIndentationLevel
queueIndentationLevel: { (indentationLevel: number): this; (whitespaceText: string): this;};
Queues the indentation level for the next lines written.
Parameter indentationLevel
Indentation level to queue.
Queues the indentation level for the next lines written using the provided indentation text.
Parameter whitespaceText
Gets the indentation level from the indentation text.
method quote
quote: { (): this; (text: string): this };
Writes a quote character.
Writes text surrounded in quotes.
Parameter text
Text to write.
method setIndentationLevel
setIndentationLevel: { (indentationLevel: number): this; (whitespaceText: string): this;};
Sets the current indentation level.
Parameter indentationLevel
Indentation level to be at.
Sets the current indentation using the provided indentation text.
Parameter whitespaceText
Gets the indentation level from the indentation text.
method space
space: (times?: number) => this;
Writes a space.
Parameter times
Number of times to write a space.
method spaceIfLastNot
spaceIfLastNot: () => this;
Writes a space if the last character was not a space.
method tab
tab: (times?: number) => this;
Writes a tab.
Parameter times
Number of times to write a tab.
method tabIfLastNot
tabIfLastNot: () => this;
Writes a tab if the last character was not a tab.
method toString
toString: () => string;
Gets the writer's text.
method unsafeInsert
unsafeInsert: (pos: number, text: string) => this;
Inserts text at the provided position.
This method is "unsafe" because it won't update the state of the writer unless inserting at the end position. It is biased towards being fast at inserting closer to the start or end, but slower to insert in the middle. Only use this if absolutely necessary.
Parameter pos
Position to insert at.
Parameter text
Text to insert.
method withIndentationLevel
withIndentationLevel: { (indentationLevel: number, action: () => void): this; (whitespaceText: string, action: () => void): this;};
Sets the indentation level within the provided action and restores the writer's indentation state afterwards.
Parameter indentationLevel
Indentation level to set.
Parameter action
Action to perform with the indentation.
Remarks
Restores the writer's state after the action.
Sets the indentation level with the provided indentation text within the provided action and restores the writer's indentation state afterwards.
Parameter whitespaceText
Gets the indentation level from the indentation text.
Parameter action
Action to perform with the indentation.
method write
write: (text: string) => this;
Writes the provided text.
Parameter text
Text to write.
method writeLine
writeLine: (text: string) => this;
Writes a line of text.
Parameter text
String to write.
class CodeFixAction
class CodeFixAction extends CodeAction<ts.CodeFixAction> {}
Represents a code fix action.
method getFixAllDescription
getFixAllDescription: () => string | undefined;
Gets the description of the code fix when fixing everything.
method getFixId
getFixId: () => {} | undefined;
If present, one may call 'getCombinedCodeFix' with this fixId. This may be omitted to indicate that the code fix can't be applied in a group.
method getFixName
getFixName: () => string;
Short name to identify the fix, for use by telemetry.
class CombinedCodeActions
class CombinedCodeActions {}
Represents file changes.
Remarks
Commands are currently not implemented.
property compilerObject
readonly compilerObject: ts.CombinedCodeActions;
Gets the compiler object.
method applyChanges
applyChanges: (options?: ApplyFileTextChangesOptions) => this;
Executes the combined code actions.
WARNING: This will cause all nodes to be forgotten in the changed files. - Options used when applying the changes.
method getChanges
getChanges: () => FileTextChanges[];
Text changes to apply to each file.
class CommaListExpression
class CommaListExpression extends CommaListExpressionBase<ts.CommaListExpression> {}
method getElements
getElements: () => Expression[];
Gets the elements.
method getParent
getParent: () => NodeParentType<ts.CommaListExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.CommaListExpression>>;
*
class CommentClassElement
class CommentClassElement extends ClassElement<CompilerCommentClassElement> {}
class CommentEnumMember
class CommentEnumMember extends Node<CompilerCommentEnumMember> {}
method remove
remove: () => void;
Removes this enum member comment.
class CommentObjectLiteralElement
class CommentObjectLiteralElement extends ObjectLiteralElement<CompilerCommentObjectLiteralElement> {}
class CommentRange
class CommentRange extends TextRange<ts.CommentRange> {}
method getKind
getKind: () => ts.CommentKind;
Gets the comment syntax kind.
class CommentStatement
class CommentStatement extends Statement<CompilerCommentStatement> {}
class CommentTypeElement
class CommentTypeElement extends TypeElement<CompilerCommentTypeElement> {}
class CompilerCommentClassElement
class CompilerCommentClassElement extends CompilerCommentNode implements ts.ClassElement {}
class CompilerCommentEnumMember
class CompilerCommentEnumMember extends CompilerCommentNode implements ts.Node {}
class CompilerCommentNode
abstract class CompilerCommentNode implements ts.Node {}
constructor
protected constructor();
property end
end: number;
property flags
flags: ts.NodeFlags;
property kind
kind: any;
property modifiers
modifiers?: any;
property parent
parent: ts.Node;
property pos
pos: number;
method forEachChild
forEachChild: <T>( cbNode: (node: ts.Node) => T | undefined, cbNodeArray?: (nodes: ts.NodeArray<ts.Node>) => T | undefined) => T | undefined;
method getChildAt
getChildAt: (index: number, sourceFile?: ts.SourceFile | undefined) => ts.Node;
method getChildCount
getChildCount: (sourceFile?: ts.SourceFile | undefined) => number;
method getChildren
getChildren: (sourceFile?: ts.SourceFile | undefined) => ts.Node[];
method getEnd
getEnd: () => number;
method getFirstToken
getFirstToken: (sourceFile?: ts.SourceFile | undefined) => ts.Node | undefined;
method getFullStart
getFullStart: () => number;
method getFullText
getFullText: (sourceFile?: ts.SourceFile | undefined) => string;
method getFullWidth
getFullWidth: () => number;
method getLastToken
getLastToken: (sourceFile?: ts.SourceFile | undefined) => ts.Node | undefined;
method getLeadingTriviaWidth
getLeadingTriviaWidth: (sourceFile?: ts.SourceFile | undefined) => number;
method getSourceFile
getSourceFile: () => ts.SourceFile;
method getStart
getStart: ( sourceFile?: ts.SourceFile | undefined, includeJsDocComment?: boolean | undefined) => number;
method getText
getText: (sourceFile?: ts.SourceFile | undefined) => string;
method getWidth
getWidth: (sourceFile?: ts.SourceFileLike | undefined) => number;
class CompilerCommentObjectLiteralElement
class CompilerCommentObjectLiteralElement extends CompilerCommentNode implements ts.ObjectLiteralElement {}
property declarationBrand
declarationBrand: any;
class CompilerCommentStatement
class CompilerCommentStatement extends CompilerCommentNode implements ts.Statement {}
class CompilerCommentTypeElement
class CompilerCommentTypeElement extends CompilerCommentNode implements ts.TypeElement {}
class CompilerOptionsContainer
class CompilerOptionsContainer extends SettingsContainer<ts.CompilerOptions> {}
Holds the compiler options.
constructor
constructor(defaultSettings?: ts.CompilerOptions);
method getEncoding
getEncoding: () => string;
Gets the encoding from the compiler options or returns utf-8.
method set
set: (settings: ts.CompilerOptions) => void;
Sets one or all of the compiler options.
WARNING: Setting the compiler options will cause a complete reparse of all the source files.
Parameter settings
Compiler options to set.
class ComputedPropertyName
class ComputedPropertyName extends ComputedPropertyNameBase<ts.ComputedPropertyName> {}
method getParent
getParent: () => NodeParentType<ts.ComputedPropertyName>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ComputedPropertyName>>;
*
class ConditionalExpression
class ConditionalExpression extends ConditionalExpressionBase<ts.ConditionalExpression> {}
method getColonToken
getColonToken: () => Node<ts.ColonToken>;
Gets the colon token of the conditional expression.
method getCondition
getCondition: () => Expression;
Gets the condition of the conditional expression.
method getParent
getParent: () => NodeParentType<ts.ConditionalExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ConditionalExpression>>;
*
method getQuestionToken
getQuestionToken: () => Node<ts.QuestionToken>;
Gets the question token of the conditional expression.
method getWhenFalse
getWhenFalse: () => Expression;
Gets the when false expression of the conditional expression.
method getWhenTrue
getWhenTrue: () => Expression;
Gets the when true expression of the conditional expression.
class ConditionalTypeNode
class ConditionalTypeNode extends TypeNode<ts.ConditionalTypeNode> {}
method getCheckType
getCheckType: () => TypeNode<ts.TypeNode>;
Gets the conditional type node's check type.
Ex. In
CheckType extends ExtendsType ? TrueType : FalseType
returnsCheckType
.
method getExtendsType
getExtendsType: () => TypeNode<ts.TypeNode>;
Gets the conditional type node's extends type.
Ex. In
CheckType extends ExtendsType ? TrueType : FalseType
returnsExtendsType
.
method getFalseType
getFalseType: () => TypeNode<ts.TypeNode>;
Gets the conditional type node's false type.
Ex. In
CheckType extends ExtendsType ? TrueType : FalseType
returnsFalseType
.
method getParent
getParent: () => NodeParentType<ts.ConditionalTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ConditionalTypeNode>>;
*
method getTrueType
getTrueType: () => TypeNode<ts.TypeNode>;
Gets the conditional type node's true type.
Ex. In
CheckType extends ExtendsType ? TrueType : FalseType
returnsTrueType
.
class ConstructorDeclaration
class ConstructorDeclaration extends ConstructorDeclarationBase<ts.ConstructorDeclaration> {}
method addOverload
addOverload: ( structure: OptionalKind<ConstructorDeclarationOverloadStructure>) => ConstructorDeclaration;
Add a constructor overload.
Parameter structure
Structure to add.
method addOverloads
addOverloads: ( structures: ReadonlyArray< OptionalKind<ConstructorDeclarationOverloadStructure> >) => ConstructorDeclaration[];
Add constructor overloads.
Parameter structures
Structures to add.
method getParent
getParent: () => NodeParentType<ts.ConstructorDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ConstructorDeclaration>>;
*
method getStructure
getStructure: () => | ConstructorDeclarationStructure | ConstructorDeclarationOverloadStructure;
Gets the structure equivalent to this node.
method insertOverload
insertOverload: ( index: number, structure: OptionalKind<ConstructorDeclarationOverloadStructure>) => ConstructorDeclaration;
Inserts a constructor overload.
Parameter index
Child index to insert at.
Parameter structure
Structures to insert.
method insertOverloads
insertOverloads: ( index: number, structures: ReadonlyArray< OptionalKind<ConstructorDeclarationOverloadStructure> >) => ConstructorDeclaration[];
Inserts constructor overloads.
Parameter index
Child index to insert at.
Parameter structures
Structures to insert.
method set
set: (structure: Partial<ConstructorDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class ConstructorTypeNode
class ConstructorTypeNode extends ConstructorTypeNodeBase<ts.ConstructorTypeNode> {}
method getParent
getParent: () => NodeParentType<ts.ConstructorTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ConstructorTypeNode>>;
*
class ConstructSignatureDeclaration
class ConstructSignatureDeclaration extends ConstructSignatureDeclarationBase<ts.ConstructSignatureDeclaration> {}
method getParent
getParent: () => NodeParentType<ts.ConstructSignatureDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ConstructSignatureDeclaration>>;
*
method getStructure
getStructure: () => ConstructSignatureDeclarationStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<ConstructSignatureDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class ContinueStatement
class ContinueStatement extends Statement<ts.ContinueStatement> {}
method getLabel
getLabel: () => Identifier | undefined;
Gets this continue statement's label or undefined if it does not exist.
method getLabelOrThrow
getLabelOrThrow: (message?: string | (() => string)) => Identifier;
Gets this continue statement's label or throw if it does not exist.
method getParent
getParent: () => NodeParentType<ts.ContinueStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ContinueStatement>>;
*
class DebuggerStatement
class DebuggerStatement extends DebuggerStatementBase<ts.DebuggerStatement> {}
method getParent
getParent: () => NodeParentType<ts.DebuggerStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.DebuggerStatement>>;
*
class Decorator
class Decorator extends DecoratorBase<ts.Decorator> {}
method addArgument
addArgument: (argumentText: string | WriterFunction) => Node<ts.Node>;
Adds an argument.
Parameter argumentTexts
Argument text.
method addArguments
addArguments: ( argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction) => Node<ts.Node>[];
Adds arguments.
Parameter argumentTexts
Argument texts.
method addTypeArgument
addTypeArgument: (argumentText: string) => TypeNode<ts.TypeNode>;
Adds a type argument.
Parameter argumentTexts
Argument text.
method addTypeArguments
addTypeArguments: ( argumentTexts: ReadonlyArray<string>) => TypeNode<ts.TypeNode>[];
Adds type arguments.
Parameter argumentTexts
Argument texts.
method getArguments
getArguments: () => Node[];
Gets the decorator's arguments from its call expression.
method getCallExpression
getCallExpression: () => CallExpression | undefined;
Gets the call expression if a decorator factory.
method getCallExpressionOrThrow
getCallExpressionOrThrow: (message?: string | (() => string)) => CallExpression;
Gets the call expression if a decorator factory, or throws.
method getFullName
getFullName: () => string;
Gets the full decorator name.
method getName
getName: () => string;
Gets the decorator name.
method getNameNode
getNameNode: () => Identifier;
Gets the name node of the decorator.
method getParent
getParent: () => NodeParentType<ts.Decorator>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.Decorator>>;
*
method getStructure
getStructure: () => DecoratorStructure;
Gets the structure equivalent to this node.
method getTypeArguments
getTypeArguments: () => TypeNode[];
Gets the decorator's type arguments from its call expression.
method insertArgument
insertArgument: ( index: number, argumentText: string | WriterFunction) => Node<ts.Node>;
Inserts an argument.
Parameter index
Child index to insert at.
Parameter argumentTexts
Argument text.
method insertArguments
insertArguments: ( index: number, argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction) => Node<ts.Node>[];
Inserts arguments.
Parameter index
Child index to insert at.
Parameter argumentTexts
Argument texts.
method insertTypeArgument
insertTypeArgument: ( index: number, argumentText: string) => TypeNode<ts.TypeNode>;
Inserts a type argument.
Parameter index
Child index to insert at.
Parameter argumentTexts
Argument text.
method insertTypeArguments
insertTypeArguments: ( index: number, argumentTexts: ReadonlyArray<string>) => TypeNode<ts.TypeNode>[];
Inserts type arguments.
Parameter index
Child index to insert at.
Parameter argumentTexts
Argument texts.
method isDecoratorFactory
isDecoratorFactory: () => boolean;
Gets if the decorator is a decorator factory.
method remove
remove: () => void;
Removes this decorator.
method removeArgument
removeArgument: { (node: Node): this; (index: number): this };
Removes an argument based on the node.
Parameter node
Argument's node to remove.
Removes an argument based on the specified index.
Parameter index
Index to remove.
method removeTypeArgument
removeTypeArgument: { (typeArg: Node): this; (index: number): this };
Removes a type argument.
Parameter typeArg
Type argument to remove.
Removes a type argument.
Parameter index
Index to remove.
method set
set: (structure: Partial<DecoratorStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setIsDecoratorFactory
setIsDecoratorFactory: (isDecoratorFactory: boolean) => this;
Set if this decorator is a decorator factory.
Parameter isDecoratorFactory
If it should be a decorator factory or not.
class DefaultClause
class DefaultClause extends DefaultClauseBase<ts.DefaultClause> {}
method getParent
getParent: () => NodeParentType<ts.DefaultClause>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.DefaultClause>>;
*
method remove
remove: () => void;
Removes the default clause.
class DefinitionInfo
class DefinitionInfo< TCompilerObject extends ts.DefinitionInfo = ts.DefinitionInfo> extends DocumentSpan<TCompilerObject> {}
Definition info.
constructor
protected constructor();
method getContainerKind
getContainerKind: () => ts.ScriptElementKind;
Gets the container kind.
method getContainerName
getContainerName: () => string;
Gets the container name.
method getDeclarationNode
getDeclarationNode: () => Node | undefined;
Gets the declaration node.
method getKind
getKind: () => ts.ScriptElementKind;
Gets the kind.
method getName
getName: () => string;
Gets the name.
class DeleteExpression
class DeleteExpression extends DeleteExpressionBase<ts.DeleteExpression> {}
method getParent
getParent: () => NodeParentType<ts.DeleteExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.DeleteExpression>>;
*
class Diagnostic
class Diagnostic<TCompilerObject extends ts.Diagnostic = ts.Diagnostic> {}
Diagnostic.
constructor
protected constructor();
property compilerObject
readonly compilerObject: ts.Diagnostic;
Gets the underlying compiler diagnostic.
method getCategory
getCategory: () => DiagnosticCategory;
Gets the diagnostic category.
method getCode
getCode: () => number;
Gets the code of the diagnostic.
method getLength
getLength: () => number | undefined;
Gets the length.
method getLineNumber
getLineNumber: () => number | undefined;
Gets the line number.
method getMessageText
getMessageText: () => string | DiagnosticMessageChain;
Gets the message text.
method getSource
getSource: () => string | undefined;
Gets the source.
method getSourceFile
getSourceFile: () => SourceFile | undefined;
Gets the source file.
method getStart
getStart: () => number | undefined;
Gets the start.
class DiagnosticMessageChain
class DiagnosticMessageChain {}
Diagnostic message chain.
property compilerObject
readonly compilerObject: ts.DiagnosticMessageChain;
Gets the underlying compiler object.
method getCategory
getCategory: () => DiagnosticCategory;
Gets the category of the diagnostic message chain.
method getCode
getCode: () => number;
Gets the code of the diagnostic message chain.
method getMessageText
getMessageText: () => string;
Gets the message text.
method getNext
getNext: () => DiagnosticMessageChain[] | undefined;
Gets the next diagnostic message chains in the chain.
class DiagnosticWithLocation
class DiagnosticWithLocation extends Diagnostic<ts.DiagnosticWithLocation> {}
method getLength
getLength: () => number;
Gets the length
method getLineNumber
getLineNumber: () => number;
Gets the line number.
method getSourceFile
getSourceFile: () => SourceFile;
Gets the source file.
method getStart
getStart: () => number;
Gets the start.
class Directory
class Directory {}
method addDirectoryAtPath
addDirectoryAtPath: ( relativeOrAbsoluteDirPath: string, options?: DirectoryAddOptions) => Directory;
Adds an existing directory from the relative path or directory name, or throws if it doesn't exist.
Will return the directory if it was already added.
Parameter relativeOrAbsoluteDirPath
Directory name or path to the directory that should be added.
Throws
DirectoryNotFoundError if the directory does not exist.
method addDirectoryAtPathIfExists
addDirectoryAtPathIfExists: ( relativeOrAbsoluteDirPath: string, options?: DirectoryAddOptions) => Directory | undefined;
Adds an existing directory from the relative path or directory name, or returns undefined if it doesn't exist.
Will return the directory if it was already added.
Parameter relativeOrAbsoluteDirPath
Directory name or path to the directory that should be added.
Parameter options
Options.
method addSourceFileAtPath
addSourceFileAtPath: (relativeFilePath: string) => SourceFile;
Adds an existing source file, relative to this directory, or throws if it doesn't exist.
Will return the source file if it was already added.
Parameter relativeFilePath
Relative file path to add.
Throws
FileNotFoundError when the file doesn't exist.
method addSourceFileAtPathIfExists
addSourceFileAtPathIfExists: ( relativeFilePath: string) => SourceFile | undefined;
Adds an existing source file, relative to this directory, or returns undefined.
Will return the source file if it was already added.
Parameter relativeFilePath
Relative file path to add.
method addSourceFilesAtPaths
addSourceFilesAtPaths: ( fileGlobs: string | ReadonlyArray<string>) => SourceFile[];
Add source files based on file globs.
Parameter fileGlobs
File glob or globs to add files based on.
Returns
The matched source files.
method clear
clear: () => void;
Recreates the directory.
Remarks
This will delete all the descendant source files and directories in memory and queue a delete & mkdir to the file system.
method clearImmediately
clearImmediately: () => Promise<void>;
Asynchronously recreates the directory.
Remarks
This will delete all the descendant source files and directories in memory and push a delete & mkdir to the file system.
method clearImmediatelySync
clearImmediatelySync: () => void;
Synchronously recreates the directory.
Remarks
This will delete all the descendant source files and directories in memory and push a delete & mkdir to the file system.
method copy
copy: ( relativeOrAbsolutePath: string, options?: DirectoryCopyOptions) => Directory;
Copies the directory to a new directory.
Parameter relativeOrAbsolutePath
The relative or absolute path to the new directory.
Parameter options
Options.
Returns
The directory the copy was made to.
method copyImmediately
copyImmediately: ( relativeOrAbsolutePath: string, options?: DirectoryCopyOptions) => Promise<Directory>;
Immediately copies the directory to the specified path asynchronously.
Parameter relativeOrAbsolutePath
Directory path as an absolute or relative path.
Parameter options
Options for moving the directory.
Remarks
If includeTrackedFiles is true, then it will execute the pending operations in the current directory.
method copyImmediatelySync
copyImmediatelySync: ( relativeOrAbsolutePath: string, options?: DirectoryCopyOptions) => Directory;
Immediately copies the directory to the specified path synchronously.
Parameter relativeOrAbsolutePath
Directory path as an absolute or relative path.
Parameter options
Options for moving the directory.
Remarks
If includeTrackedFiles is true, then it will execute the pending operations in the current directory.
method copyToDirectory
copyToDirectory: ( dirPathOrDirectory: string | Directory, options?: DirectoryCopyOptions) => Directory;
Copies the directory to a subdirectory of the specified directory.
Parameter dirPathOrDirectory
Directory path or directory object to copy the directory to.
Parameter options
Options for copying.
Returns
The new copied directory.
method createDirectory
createDirectory: (relativeOrAbsoluteDirPath: string) => Directory;
Creates a directory if it doesn't exist.
Parameter relativeOrAbsoluteDirPath
Relative or absolute path to the directory that should be created.
method createSourceFile
createSourceFile: ( relativeFilePath: string, sourceFileText?: string | OptionalKind<SourceFileStructure> | WriterFunction, options?: SourceFileCreateOptions) => SourceFile;
Creates a source file, relative to this directory.
Note: The file will not be created and saved to the file system until .save() is called on the source file.
Parameter relativeFilePath
Relative file path of the source file to create.
Parameter sourceFileText
Text, structure, or writer function to create the source file text with.
Parameter options
Options.
Throws
- InvalidOperationError if a source file already exists at the provided file name.
method delete
delete: () => void;
Queues a deletion of the directory to the file system.
The directory will be deleted when calling ast.save(). If you wish to delete the file immediately, then use deleteImmediately().
method deleteImmediately
deleteImmediately: () => Promise<void>;
Asyncronously deletes the directory and all its descendants from the file system.
method deleteImmediatelySync
deleteImmediatelySync: () => void;
Synchronously deletes the directory and all its descendants from the file system.
method emit
emit: (options?: { emitOnlyDtsFiles?: boolean; outDir?: string; declarationDir?: string;}) => Promise<DirectoryEmitResult>;
Emits the files in the directory.
Parameter options
Options for emitting.
method emitSync
emitSync: (options?: { emitOnlyDtsFiles?: boolean; outDir?: string; declarationDir?: string;}) => DirectoryEmitResult;
Emits the files in the directory synchronously.
Remarks: This might be very slow compared to the asynchronous version if there are a lot of files.
Parameter options
Options for emitting.
method forget
forget: () => void;
Forgets the directory and all its descendants from the Project.
Note: Does not delete the directory from the file system.
method getBaseName
getBaseName: () => string;
Gets the directory path's base name.
method getDescendantDirectories
getDescendantDirectories: () => Directory[];
Gets the descendant directories.
method getDescendantSourceFiles
getDescendantSourceFiles: () => SourceFile[];
Gets the source files in the current directory and all the descendant directories.
method getDirectories
getDirectories: () => Directory[];
Gets the child directories.
method getDirectory
getDirectory: { (path: string): Directory | undefined; (condition: (directory: Directory) => boolean): Directory;};
Gets a directory with the specified path or undefined if not found.
Parameter path
Relative path from this directory or absolute path.
Gets a child directory by the specified condition or undefined if not found.
Parameter condition
Condition to check the directory with.
method getDirectoryOrThrow
getDirectoryOrThrow: { (path: string): Directory; (condition: (directory: Directory) => boolean): Directory;};
Gets a child directory with the specified path or throws if not found.
Parameter path
Relative path from this directory or absolute path.
Gets a child directory by the specified condition or throws if not found.
Parameter condition
Condition to check the directory with.
method getParent
getParent: () => Directory | undefined;
Gets the parent directory if it exists and was added to the project.
method getParentOrThrow
getParentOrThrow: (message?: string | (() => string)) => Directory;
Gets the parent directory or throws if it doesn't exist or was never added to the project.
method getPath
getPath: () => StandardizedFilePath;
Gets the path to the directory.
method getProject
getProject: () => Project;
Gets the project.
method getRelativePathAsModuleSpecifierTo
getRelativePathAsModuleSpecifierTo: { (filePath: string): string; (sourceFile: SourceFile): string; (directory: Directory): string;};
Gets the relative path to the specified file path as a module specifier.
Parameter filePath
File path.
Remarks
To get to a directory, provide
path/to/directory/index.ts
.Gets the relative path to the specified source file as a module specifier.
Parameter sourceFile
Source file.
Gets the relative path to the specified directory as a module specifier.
Parameter directory
Directory.
method getRelativePathTo
getRelativePathTo: { (fileOrDirPath: string): string; (sourceFile: SourceFile): string; (directory: Directory): string;};
Gets the relative path to the specified path.
Parameter fileOrDirPath
The file or directory path.
Gets the relative path to another source file.
Parameter sourceFile
Source file.
Gets the relative path to another directory.
Parameter directory
Directory.
method getSourceFile
getSourceFile: { (path: string): SourceFile | undefined; (condition: (sourceFile: SourceFile) => boolean): SourceFile;};
Gets a child source file with the specified path or undefined if not found.
Parameter path
Relative or absolute path to the file.
Gets a child source file by the specified condition or undefined if not found.
Parameter condition
Condition to check the source file with.
method getSourceFileOrThrow
getSourceFileOrThrow: { (path: string): SourceFile; (condition: (sourceFile: SourceFile) => boolean): SourceFile;};
Gets a child source file with the specified path or throws if not found.
Parameter path
Relative or absolute path to the file.
Gets a child source file by the specified condition or throws if not found.
Parameter condition
Condition to check the source file with.
method getSourceFiles
getSourceFiles: { (): SourceFile[]; (globPattern: string): SourceFile[]; (globPatterns: readonly string[]): SourceFile[];};
Gets the source files within this directory.
Gets all the source files added to the project relative to the directory that match a pattern.
Parameter globPattern
Glob pattern for filtering out the source files.
Gets all the source files added to the project relative to the directory that match the provided patterns.
Parameter globPatterns
Glob patterns for filtering out the source files.
method isAncestorOf
isAncestorOf: (possibleDescendant: Directory | SourceFile) => boolean;
Checks if this directory is an ancestor of the provided directory.
Parameter possibleDescendant
Directory or source file that's a possible descendant.
method isDescendantOf
isDescendantOf: (possibleAncestor: Directory) => boolean;
Checks if this directory is a descendant of the provided directory.
Parameter possibleAncestor
Directory or source file that's a possible ancestor.
method move
move: (relativeOrAbsolutePath: string, options?: DirectoryMoveOptions) => this;
Moves the directory to a new path.
Parameter relativeOrAbsolutePath
Directory path as an absolute or relative path.
Parameter options
Options for moving the directory.
method moveImmediately
moveImmediately: ( relativeOrAbsolutePath: string, options?: DirectoryMoveOptions) => Promise<this>;
Immediately moves the directory to a new path asynchronously.
Parameter relativeOrAbsolutePath
Directory path as an absolute or relative path.
Parameter options
Options for moving the directory.
method moveImmediatelySync
moveImmediatelySync: ( relativeOrAbsolutePath: string, options?: DirectoryMoveOptions) => this;
Immediately moves the directory to a new path synchronously.
Parameter relativeOrAbsolutePath
Directory path as an absolute or relative path.
Parameter options
Options for moving the directory.
method moveToDirectory
moveToDirectory: ( dirPathOrDirectory: string | Directory, options?: DirectoryMoveOptions) => this;
Moves the directory to a subdirectory of the specified directory.
Parameter dirPathOrDirectory
Directory path or directory object to move the directory to.
Parameter options
Options for moving.
method save
save: () => Promise<void>;
Asynchronously saves the directory and all the unsaved source files to the disk.
method saveSync
saveSync: () => void;
Synchronously saves the directory and all the unsaved source files to the disk.
method wasForgotten
wasForgotten: () => boolean;
Gets if the directory was forgotten.
class DirectoryEmitResult
class DirectoryEmitResult {}
method getOutputFilePaths
getOutputFilePaths: () => StandardizedFilePath[];
Gets the output file paths.
method getSkippedFilePaths
getSkippedFilePaths: () => StandardizedFilePath[];
Gets a collections of skipped file paths.
class DocumentSpan
class DocumentSpan<TCompilerObject extends ts.DocumentSpan = ts.DocumentSpan> {}
Document span.
constructor
protected constructor();
property compilerObject
readonly compilerObject: ts.DocumentSpan;
Gets the compiler object.
method getNode
getNode: () => Node<ts.Node>;
Gets the node at the start of the text span.
method getOriginalFileName
getOriginalFileName: () => string | undefined;
Gets the original file name if the span represents a location that was remapped.
method getOriginalTextSpan
getOriginalTextSpan: () => TextSpan | undefined;
Gets the original text span if the span represents a location that was remapped.
method getSourceFile
getSourceFile: () => SourceFile;
Gets the source file this reference is in.
method getTextSpan
getTextSpan: () => TextSpan;
Gets the text span.
class DoStatement
class DoStatement extends DoStatementBase<ts.DoStatement> {}
method getParent
getParent: () => NodeParentType<ts.DoStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.DoStatement>>;
*
class ElementAccessExpression
class ElementAccessExpression< T extends ts.ElementAccessExpression = ts.ElementAccessExpression> extends ElementAccessExpressionBase<T> {}
method getArgumentExpression
getArgumentExpression: () => Expression | undefined;
Gets this element access expression's argument expression or undefined if none exists.
method getArgumentExpressionOrThrow
getArgumentExpressionOrThrow: ( message?: string | (() => string)) => Expression<ts.Expression>;
Gets this element access expression's argument expression or throws if none exists.
class EmitOutput
class EmitOutput {}
Output of an emit on a single file.
property compilerObject
readonly compilerObject: ts.EmitOutput;
TypeScript compiler emit result.
method getDiagnostics
getDiagnostics: () => Diagnostic<ts.Diagnostic>[];
Gets the diagnostics.
method getEmitSkipped
getEmitSkipped: () => boolean;
Gets if the emit was skipped.
method getOutputFiles
getOutputFiles: () => OutputFile[];
Gets the output files.
class EmitResult
class EmitResult {}
Result of an emit.
constructor
protected constructor();
property compilerObject
readonly compilerObject: ts.EmitResult;
TypeScript compiler emit result.
method getDiagnostics
getDiagnostics: () => Diagnostic<ts.Diagnostic>[];
Contains declaration emit diagnostics.
If the
noEmitOnError
compiler option is true, this will also include the program's semantic, syntactic, global, options, and if enabled declaration diagnostics.Remarks
If you are looking for non-declaration emit diagnostics, then call
Project#getPreEmitDiagnostics()
or get specific diagnostics available from the program.
method getEmitSkipped
getEmitSkipped: () => boolean;
If the emit was skipped.
class EmptyStatement
class EmptyStatement extends EmptyStatementBase<ts.EmptyStatement> {}
method getParent
getParent: () => NodeParentType<ts.EmptyStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.EmptyStatement>>;
*
class EnumDeclaration
class EnumDeclaration extends EnumDeclarationBase<ts.EnumDeclaration> {}
method addMember
addMember: { (structure: OptionalKind<EnumMemberStructure>): EnumMember; (structure: string | WriterFunction | OptionalKind<EnumMemberStructure>): | EnumMember | CommentEnumMember;};
Adds a member to the enum.
Parameter structure
Structure of the enum.
method addMembers
addMembers: { (structures: ReadonlyArray<OptionalKind<EnumMemberStructure>>): EnumMember[]; ( structures: | string | WriterFunction | readonly ( | string | WriterFunction | OptionalKind<EnumMemberStructure> )[] ): (EnumMember | CommentEnumMember)[];};
Adds members to the enum.
Parameter structures
Structures of the enums.
method getConstKeyword
getConstKeyword: () => Node<ts.Node> | undefined;
Gets the const enum keyword or undefined if not exists.
method getMember
getMember: { (name: string): EnumMember | undefined; (findFunction: (declaration: EnumMember) => boolean): EnumMember;};
Gets an enum member.
Parameter name
Name of the member.
Gets an enum member.
Parameter findFunction
Function to use to find the member.
method getMemberOrThrow
getMemberOrThrow: { (name: string): EnumMember; (findFunction: (declaration: EnumMember) => boolean): EnumMember;};
Gets an enum member or throws if not found.
Parameter name
Name of the member.
Gets an enum member or throws if not found.
Parameter findFunction
Function to use to find the member.
method getMembers
getMembers: () => EnumMember[];
Gets the enum's members.
method getMembersWithComments
getMembersWithComments: () => (EnumMember | CommentEnumMember)[];
Gets the enum's members with comment enum members.
method getParent
getParent: () => NodeParentType<ts.EnumDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.EnumDeclaration>>;
*
method getStructure
getStructure: () => EnumDeclarationStructure;
Gets the structure equivalent to this node.
method insertMember
insertMember: { (index: number, structure: OptionalKind<EnumMemberStructure>): EnumMember; ( index: number, structure: string | WriterFunction | OptionalKind<EnumMemberStructure> ): EnumMember | CommentEnumMember;};
Inserts a member to the enum.
Parameter index
Child index to insert at.
Parameter structure
Structure of the enum.
method insertMembers
insertMembers: { ( index: number, structures: ReadonlyArray<OptionalKind<EnumMemberStructure>> ): EnumMember[]; ( index: number, structures: | string | WriterFunction | readonly ( | string | WriterFunction | OptionalKind<EnumMemberStructure> )[] ): (EnumMember | CommentEnumMember)[];};
Inserts members to an enum.
Parameter index
Child index to insert at.
Parameter structures
Structures of the enums.
method isConstEnum
isConstEnum: () => boolean;
Gets if it's a const enum.
method set
set: (structure: Partial<EnumDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setIsConstEnum
setIsConstEnum: (value: boolean) => this;
Toggle if it's a const enum.
class EnumMember
class EnumMember extends EnumMemberBase<ts.EnumMember> {}
method getParent
getParent: () => NodeParentType<ts.EnumMember>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.EnumMember>>;
*
method getStructure
getStructure: () => EnumMemberStructure;
Gets the structure equivalent to this node.
method getValue
getValue: () => string | number | undefined;
Gets the constant value of the enum.
method remove
remove: () => void;
Removes this enum member.
method set
set: (structure: Partial<EnumMemberStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setValue
setValue: (value: string | number) => this;
Sets the enum value.
This is a helper method. Use
#setInitializer
if you want to set the initializer to something other than a string or number.Parameter value
Enum value.
class ExportAssignment
class ExportAssignment extends ExportAssignmentBase<ts.ExportAssignment> {}
method getParent
getParent: () => NodeParentType<ts.ExportAssignment>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ExportAssignment>>;
*
method getStructure
getStructure: () => ExportAssignmentStructure;
Gets the structure equivalent to this node.
method isExportEquals
isExportEquals: () => boolean;
Gets if this is an export equals assignment.
If this is false, then it's
export default
.
method set
set: (structure: Partial<ExportAssignmentStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setIsExportEquals
setIsExportEquals: (value: boolean) => this;
Sets if this is an export equals assignment or export default.
Parameter value
Whether it should be an export equals assignment.
class ExportDeclaration
class ExportDeclaration extends ExportDeclarationBase<ts.ExportDeclaration> {}
method addNamedExport
addNamedExport: ( namedExport: OptionalKind<ExportSpecifierStructure> | string | WriterFunction) => ExportSpecifier;
Adds a named export.
Parameter namedExport
Structure, name, or writer function to write the named export.
method addNamedExports
addNamedExports: ( namedExports: | ReadonlyArray< OptionalKind<ExportSpecifierStructure> | string | WriterFunction > | WriterFunction) => ExportSpecifier[];
Adds named exports.
Parameter namedExports
Structures, names, or writer function to write the named exports.
method getAttributes
getAttributes: () => ImportAttributes | undefined;
Gets the import attributes or returns undefined if it doesn't exist.
method getModuleSpecifier
getModuleSpecifier: () => StringLiteral | undefined;
Gets the module specifier or undefined if it doesn't exist.
method getModuleSpecifierSourceFile
getModuleSpecifierSourceFile: () => SourceFile | undefined;
Gets the source file referenced in the module specifier.
method getModuleSpecifierSourceFileOrThrow
getModuleSpecifierSourceFileOrThrow: ( message?: string | (() => string)) => SourceFile;
Gets the source file referenced in the module specifier or throws if it can't find it or it doesn't exist.
method getModuleSpecifierValue
getModuleSpecifierValue: () => string | undefined;
Gets the module specifier value or undefined if it doesn't exist.
method getNamedExports
getNamedExports: () => ExportSpecifier[];
Gets the named exports.
method getNamespaceExport
getNamespaceExport: () => NamespaceExport | undefined;
Gets the namespace export or returns undefined if it doesn't exist. (ex.
* as ns
, but not*
).
method getNamespaceExportOrThrow
getNamespaceExportOrThrow: ( message?: string | (() => string)) => NamespaceExport;
Gets the namespace export or throws if it doesn't exist. (ex.
* as ns
, but not*
)
method getParent
getParent: () => NodeParentType<ts.ExportDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ExportDeclaration>>;
*
method getStructure
getStructure: () => ExportDeclarationStructure;
Gets the structure equivalent to this node.
method hasModuleSpecifier
hasModuleSpecifier: () => boolean;
Gets if the module specifier exists
method hasNamedExports
hasNamedExports: () => boolean;
Gets if the export declaration has named exports.
method insertNamedExport
insertNamedExport: ( index: number, namedExport: OptionalKind<ExportSpecifierStructure> | string | WriterFunction) => ExportSpecifier;
Inserts a named export.
Parameter index
Child index to insert at.
Parameter namedExport
Structure, name, or writer function to write the named export.
method insertNamedExports
insertNamedExports: ( index: number, namedExports: | ReadonlyArray< OptionalKind<ExportSpecifierStructure> | string | WriterFunction > | WriterFunction) => ExportSpecifier[];
Inserts named exports into the export declaration.
Parameter index
Child index to insert at.
Parameter namedExports
Structures, names, or writer funciton to write the named exports.
method isModuleSpecifierRelative
isModuleSpecifierRelative: () => boolean;
Gets if the module specifier starts with
./
or../
.
method isNamespaceExport
isNamespaceExport: () => boolean;
Gets if this export declaration is a namespace export.
method isTypeOnly
isTypeOnly: () => boolean;
Gets if this export declaration is type only.
method removeModuleSpecifier
removeModuleSpecifier: () => this;
Removes the module specifier.
method set
set: (structure: Partial<ExportDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setAttributes
setAttributes: ( elements: ReadonlyArray<OptionalKind<ImportAttributeStructure>> | undefined) => this;
Sets the import attributes.
method setIsTypeOnly
setIsTypeOnly: (value: boolean) => this;
Sets if this export declaration is type only.
method setModuleSpecifier
setModuleSpecifier: { (text: string): this; (sourceFile: SourceFile): this };
Sets the import specifier.
Parameter text
Text to set as the module specifier.
Sets the import specifier.
Parameter sourceFile
Source file to set the module specifier from.
method setNamespaceExport
setNamespaceExport: (name: string) => this;
Sets the namespace export name.
method toNamespaceExport
toNamespaceExport: () => this;
Changes the export declaration to namespace export. Removes all the named exports.
class ExportSpecifier
class ExportSpecifier extends ExportSpecifierBase<ts.ExportSpecifier> {}
method getAliasNode
getAliasNode: () => StringLiteral | Identifier | undefined;
Gets the alias identifier, if it exists.
method getExportDeclaration
getExportDeclaration: () => ExportDeclaration;
Gets the export declaration associated with this export specifier.
method getLocalTargetDeclarations
getLocalTargetDeclarations: () => LocalTargetDeclarations[];
Gets all the declarations referenced by the export specifier.
method getLocalTargetSymbol
getLocalTargetSymbol: () => Symbol | undefined;
Gets the local target symbol of the export specifier or undefined if it doesn't exist.
method getLocalTargetSymbolOrThrow
getLocalTargetSymbolOrThrow: (message?: string | (() => string)) => Symbol;
Gets the local target symbol of the export specifier or throws if it doesn't exist.
method getName
getName: () => string;
Gets the name of the export specifier.
method getNameNode
getNameNode: () => StringLiteral | Identifier;
Gets the name node of what's being exported.
method getParent
getParent: () => NodeParentType<ts.ExportSpecifier>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ExportSpecifier>>;
*
method getStructure
getStructure: () => ExportSpecifierStructure;
Gets the structure equivalent to this node.
method isTypeOnly
isTypeOnly: () => boolean;
Gets if this is a type only import specifier.
method remove
remove: () => void;
Removes the export specifier.
method removeAlias
removeAlias: () => this;
Removes the alias without renaming.
Remarks
Use removeAliasWithRename() if you want it to rename any usages to the name of the export specifier.
method removeAliasWithRename
removeAliasWithRename: () => this;
Removes the alias and renames any usages to the name of the export specifier.
method renameAlias
renameAlias: (alias: string) => this;
Sets the alias for the name being exported and renames all the usages.
Parameter alias
Alias to set.
method set
set: (structure: Partial<ExportSpecifierStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setAlias
setAlias: (alias: string) => this;
Sets the alias without renaming all the usages.
Parameter alias
Alias to set.
method setIsTypeOnly
setIsTypeOnly: (value: boolean) => this;
Sets if this is a type only import specifier.
method setName
setName: (name: string) => this;
Sets the name of what's being exported.
class Expression
class Expression<T extends ts.Expression = ts.Expression> extends Node<T> {}
method getContextualType
getContextualType: () => Type | undefined;
Gets the contextual type of the expression.
class ExpressionStatement
class ExpressionStatement extends ExpressionStatementBase<ts.ExpressionStatement> {}
method getParent
getParent: () => NodeParentType<ts.ExpressionStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ExpressionStatement>>;
*
class ExpressionWithTypeArguments
class ExpressionWithTypeArguments extends ExpressionWithTypeArgumentsBase<ts.ExpressionWithTypeArguments> {}
method getParent
getParent: () => NodeParentType<ts.ExpressionWithTypeArguments>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ExpressionWithTypeArguments>>;
*
class ExternalModuleReference
class ExternalModuleReference extends ExternalModuleReferenceBase<ts.ExternalModuleReference> {}
method getParent
getParent: () => NodeParentType<ts.ExternalModuleReference>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ExternalModuleReference>>;
*
method getReferencedSourceFile
getReferencedSourceFile: () => SourceFile | undefined;
Gets the source file referenced or returns undefined if it can't find it.
method getReferencedSourceFileOrThrow
getReferencedSourceFileOrThrow: ( message?: string | (() => string)) => SourceFile;
Gets the source file referenced or throws if it can't find it.
method isRelative
isRelative: () => boolean;
Gets if the external module reference is relative.
class FalseLiteral
class FalseLiteral extends FalseLiteralBase<ts.FalseLiteral> {}
method getLiteralValue
getLiteralValue: () => boolean;
Gets the literal value.
method getParent
getParent: () => NodeParentType<ts.FalseLiteral>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.FalseLiteral>>;
*
method setLiteralValue
setLiteralValue: (value: boolean) => this | TrueLiteral;
Sets the literal value.
Note: This forgets the current node and returns the new node if the value changes.
Parameter value
Value to set.
class FileReference
class FileReference extends TextRange<ts.FileReference> {}
constructor
constructor(compilerObject: ts.FileReference, sourceFile: SourceFile);
method getFileName
getFileName: () => string;
Gets the referenced file name.
class FileTextChanges
class FileTextChanges {}
method applyChanges
applyChanges: (options?: ApplyFileTextChangesOptions) => this | undefined;
Applies the text changes to the file. This modifies and possibly creates a new source file.
WARNING: This will forget any previously navigated descendant nodes in the source file.
Parameter options
Options for applying the text changes to the file.
method getFilePath
getFilePath: () => string;
Gets the file path.
method getSourceFile
getSourceFile: () => SourceFile | undefined;
Gets the source file if it was in the cache at the time of this class' creation.
method getTextChanges
getTextChanges: () => TextChange[];
Gets the text changes
method isNewFile
isNewFile: () => boolean;
Gets if this change is for creating a new file.
class ForInStatement
class ForInStatement extends ForInStatementBase<ts.ForInStatement> {}
method getInitializer
getInitializer: () => VariableDeclarationList | Expression;
Gets this for in statement's initializer.
method getParent
getParent: () => NodeParentType<ts.ForInStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ForInStatement>>;
*
class ForOfStatement
class ForOfStatement extends ForOfStatementBase<ts.ForOfStatement> {}
method getInitializer
getInitializer: () => VariableDeclarationList | Expression;
Gets this for of statement's initializer.
method getParent
getParent: () => NodeParentType<ts.ForOfStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ForOfStatement>>;
*
class ForStatement
class ForStatement extends ForStatementBase<ts.ForStatement> {}
method getCondition
getCondition: () => Expression | undefined;
Gets this for statement's condition or undefined if none exists.
method getConditionOrThrow
getConditionOrThrow: ( message?: string | (() => string)) => Expression<ts.Expression>;
Gets this for statement's condition or throws if none exists.
method getIncrementor
getIncrementor: () => Expression | undefined;
Gets this for statement's incrementor.
method getIncrementorOrThrow
getIncrementorOrThrow: ( message?: string | (() => string)) => Expression<ts.Expression>;
Gets this for statement's incrementor or throws if none exists.
method getInitializer
getInitializer: () => VariableDeclarationList | Expression | undefined;
Gets this for statement's initializer or undefined if none exists.
method getInitializerOrThrow
getInitializerOrThrow: ( message?: string | (() => string)) => Expression<ts.Expression> | VariableDeclarationList;
Gets this for statement's initializer or throws if none exists.
method getParent
getParent: () => NodeParentType<ts.ForStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ForStatement>>;
*
class FunctionDeclaration
class FunctionDeclaration extends FunctionDeclarationBase<ts.FunctionDeclaration> {}
method addOverload
addOverload: ( structure: OptionalKind<FunctionDeclarationOverloadStructure>) => FunctionDeclaration;
Adds a function overload.
Parameter structure
Structure of the overload.
method addOverloads
addOverloads: ( structures: ReadonlyArray<OptionalKind<FunctionDeclarationOverloadStructure>>) => FunctionDeclaration[];
Adds function overloads.
Parameter structures
Structures of the overloads.
method getParent
getParent: () => NodeParentType<ts.FunctionDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.FunctionDeclaration>>;
*
method getStructure
getStructure: () => | FunctionDeclarationStructure | FunctionDeclarationOverloadStructure;
Gets the structure equivalent to this node.
method insertOverload
insertOverload: ( index: number, structure: OptionalKind<FunctionDeclarationOverloadStructure>) => FunctionDeclaration;
Inserts a function overload.
Parameter index
Child index to insert at.
Parameter structure
Structure of the overload.
method insertOverloads
insertOverloads: ( index: number, structures: ReadonlyArray<OptionalKind<FunctionDeclarationOverloadStructure>>) => FunctionDeclaration[];
Inserts function overloads.
Parameter index
Child index to insert at.
Parameter structure
Structures of the overloads.
method remove
remove: () => void;
Removes this function declaration.
method set
set: (structure: Partial<FunctionDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class FunctionExpression
class FunctionExpression extends FunctionExpressionBase<ts.FunctionExpression> {}
method getParent
getParent: () => NodeParentType<ts.FunctionExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.FunctionExpression>>;
*
class FunctionOrConstructorTypeNodeBase
class FunctionOrConstructorTypeNodeBase< T extends ts.FunctionOrConstructorTypeNode = ts.FunctionOrConstructorTypeNode> extends FunctionOrConstructorTypeNodeBaseBase<T> {}
class FunctionTypeNode
class FunctionTypeNode extends FunctionTypeNodeBase<ts.FunctionTypeNode> {}
method getParent
getParent: () => NodeParentType<ts.FunctionTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.FunctionTypeNode>>;
*
class GetAccessorDeclaration
class GetAccessorDeclaration extends GetAccessorDeclarationBase<ts.GetAccessorDeclaration> {}
method getParent
getParent: () => NodeParentType<ts.GetAccessorDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.GetAccessorDeclaration>>;
*
method getSetAccessor
getSetAccessor: () => SetAccessorDeclaration | undefined;
Gets the corresponding set accessor if one exists.
method getSetAccessorOrThrow
getSetAccessorOrThrow: ( message?: string | (() => string)) => SetAccessorDeclaration;
Gets the corresponding set accessor or throws if not exists.
method getStructure
getStructure: () => GetAccessorDeclarationStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<GetAccessorDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class HeritageClause
class HeritageClause extends Node<ts.HeritageClause> {}
method getParent
getParent: () => NodeParentType<ts.HeritageClause>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.HeritageClause>>;
*
method getToken
getToken: () => SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword;
Gets the heritage clause token.
method getTypeNodes
getTypeNodes: () => ExpressionWithTypeArguments[];
Gets all the type nodes for the heritage clause.
method removeExpression
removeExpression: { (index: number): this; (expressionNode: ExpressionWithTypeArguments): this;};
Remove the expression from the heritage clause.
Parameter index
Index of the expression to remove.
Removes the expression from the heritage clause.
Parameter expressionNode
Expression to remove.
class Identifier
class Identifier extends IdentifierBase<ts.Identifier> {}
method getImplementations
getImplementations: () => ImplementationLocation[];
Gets the implementations of the identifier.
This is similar to "go to implementation."
method getParent
getParent: () => NodeParentType<ts.Identifier>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.Identifier>>;
*
class IfStatement
class IfStatement extends IfStatementBase<ts.IfStatement> {}
method getElseStatement
getElseStatement: () => Statement | undefined;
Gets this if statement's else statement.
method getParent
getParent: () => NodeParentType<ts.IfStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.IfStatement>>;
*
method getThenStatement
getThenStatement: () => Statement;
Gets this if statement's then statement.
method remove
remove: () => void;
class ImplementationLocation
class ImplementationLocation extends DocumentSpan<ts.ImplementationLocation> {}
method getDisplayParts
getDisplayParts: () => SymbolDisplayPart[];
Gets the display parts.
method getKind
getKind: () => ts.ScriptElementKind;
Gets the kind.
class ImportAttribute
class ImportAttribute extends ImportAttributeBase<ts.ImportAttribute> {}
method getParent
getParent: () => NodeParentType<ts.ImportAttribute>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ImportAttribute>>;
*
method getStructure
getStructure: () => ImportAttributeStructure;
Gets the structure equivalent to this node.
method getValue
getValue: () => Expression;
Gets the value of the assert entry.
method set
set: (structure: Partial<ImportAttributeStructure>) => this;
Sets the name and value.
class ImportAttributes
class ImportAttributes extends ImportAttributesBase<ts.ImportAttributes> {}
method getElements
getElements: () => ImportAttribute[];
Gets the elements of the import attributes.
method getParent
getParent: () => NodeParentType<ts.ImportAttributes>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ImportAttributes>>;
*
method remove
remove: () => void;
Removes the assert clause.
method setElements
setElements: ( elements: ReadonlyArray<OptionalKind<ImportAttributeStructure>>) => this;
Sets the elements in the import attributes
class ImportClause
class ImportClause extends ImportClauseBase<ts.ImportClause> {}
method getDefaultImport
getDefaultImport: () => Identifier | undefined;
Gets the default import or returns undefined if it doesn't exist.
method getDefaultImportOrThrow
getDefaultImportOrThrow: (message?: string | (() => string)) => Identifier;
Gets the default import or throws if it doesn't exit.
method getNamedBindings
getNamedBindings: () => NamespaceImport | NamedImports | undefined;
Gets the named bindings of the import clause or returns undefined if it doesn't exist.
method getNamedBindingsOrThrow
getNamedBindingsOrThrow: ( message?: string | (() => string)) => NamespaceImport | NamedImports;
Gets the named bindings of the import clause or throws if it doesn't exist.
method getNamedImports
getNamedImports: () => ImportSpecifier[];
Gets the namespace import identifier, if it exists.
method getNamespaceImport
getNamespaceImport: () => Identifier | undefined;
Gets the namespace import identifier, if it exists.
method getNamespaceImportOrThrow
getNamespaceImportOrThrow: (message?: string | (() => string)) => Identifier;
Gets the namespace import if it exists or throws.
method getParent
getParent: () => NodeParentType<ts.ImportClause>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ImportClause>>;
*
method isTypeOnly
isTypeOnly: () => boolean;
Gets if this import clause is type only.
method setIsTypeOnly
setIsTypeOnly: (value: boolean) => this;
Sets if this import declaration is type only.
class ImportDeclaration
class ImportDeclaration extends ImportDeclarationBase<ts.ImportDeclaration> {}
method addNamedImport
addNamedImport: ( namedImport: OptionalKind<ImportSpecifierStructure> | string | WriterFunction) => ImportSpecifier;
Adds a named import.
Parameter namedImport
Name, structure, or writer to write the named import with.
method addNamedImports
addNamedImports: ( namedImports: | ReadonlyArray< OptionalKind<ImportSpecifierStructure> | string | WriterFunction > | WriterFunction) => ImportSpecifier[];
Adds named imports.
Parameter namedImport
Structures, names, or writer function to write the named import with.
method getAttributes
getAttributes: () => ImportAttributes | undefined;
Gets the import attributes or returns undefined if it doesn't exist.
method getDefaultImport
getDefaultImport: () => Identifier | undefined;
Gets the default import or returns undefined if it doesn't exist.
method getDefaultImportOrThrow
getDefaultImportOrThrow: (message?: string | (() => string)) => Identifier;
Gets the default import or throws if it doesn't exit.
method getImportClause
getImportClause: () => ImportClause | undefined;
Gets the import clause or returns undefined if it doesn't exist.
method getImportClauseOrThrow
getImportClauseOrThrow: (message?: string | (() => string)) => ImportClause;
Gets the import clause or throws if it doesn't exist.
method getModuleSpecifier
getModuleSpecifier: () => StringLiteral;
Gets the module specifier.
method getModuleSpecifierSourceFile
getModuleSpecifierSourceFile: () => SourceFile | undefined;
Gets the source file referenced in the module specifier or returns undefined if it can't find it.
method getModuleSpecifierSourceFileOrThrow
getModuleSpecifierSourceFileOrThrow: ( message?: string | (() => string)) => SourceFile;
Gets the source file referenced in the module specifier or throws if it can't find it.
method getModuleSpecifierValue
getModuleSpecifierValue: () => string;
Gets the module specifier string literal value.
method getNamedImports
getNamedImports: () => ImportSpecifier[];
Gets the named imports.
method getNamespaceImport
getNamespaceImport: () => Identifier | undefined;
Gets the namespace import identifier, if it exists.
method getNamespaceImportOrThrow
getNamespaceImportOrThrow: (message?: string | (() => string)) => Identifier;
Gets the namespace import if it exists or throws.
method getParent
getParent: () => NodeParentType<ts.ImportDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ImportDeclaration>>;
*
method getStructure
getStructure: () => ImportDeclarationStructure;
Gets the structure equivalent to this node.
method insertNamedImport
insertNamedImport: ( index: number, namedImport: OptionalKind<ImportSpecifierStructure> | string | WriterFunction) => ImportSpecifier;
Inserts a named import.
Parameter index
Child index to insert at.
Parameter namedImport
Structure, name, or writer function to write the named import with.
method insertNamedImports
insertNamedImports: ( index: number, namedImports: | ReadonlyArray< OptionalKind<ImportSpecifierStructure> | string | WriterFunction > | WriterFunction) => ImportSpecifier[];
Inserts named imports into the import declaration.
Parameter index
Child index to insert at.
Parameter namedImports
Structures, names, or writer function to write the named import with.
method isModuleSpecifierRelative
isModuleSpecifierRelative: () => boolean;
Gets if the module specifier starts with
./
or../
.
method isTypeOnly
isTypeOnly: () => boolean;
Gets if this import declaration is type only.
method removeDefaultImport
removeDefaultImport: () => this;
Removes the default import.
method removeNamedImports
removeNamedImports: () => this;
Removes all the named imports.
Remarks
To remove a single named import, get the named import and call
#remove()
on it.
method removeNamespaceImport
removeNamespaceImport: () => this;
Removes the namespace import.
method renameDefaultImport
renameDefaultImport: (text: string) => this;
Renames or sets the provided default import.
Parameter text
Text to set or rename the default import with.
method set
set: (structure: Partial<ImportDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setAttributes
setAttributes: ( elements: ReadonlyArray<OptionalKind<ImportAttributeStructure>> | undefined) => this;
Sets the import attributes.
method setDefaultImport
setDefaultImport: (text: string) => this;
Sets the default import.
Parameter text
Text to set as the default import.
Remarks
Use renameDefaultImport to rename.
method setIsTypeOnly
setIsTypeOnly: (value: boolean) => this;
Sets if this import declaration is type only.
method setModuleSpecifier
setModuleSpecifier: { (text: string): this; (sourceFile: SourceFile): this };
Sets the import specifier.
Parameter text
Text to set as the module specifier.
Sets the import specifier.
Parameter sourceFile
Source file to set the module specifier from.
method setNamespaceImport
setNamespaceImport: (text: string) => this;
Sets the namespace import.
Parameter text
Text to set as the namespace import.
Throws
- InvalidOperationError if a named import exists.
class ImportEqualsDeclaration
class ImportEqualsDeclaration extends ImportEqualsDeclarationBase<ts.ImportEqualsDeclaration> {}
method getExternalModuleReferenceSourceFile
getExternalModuleReferenceSourceFile: () => SourceFile | undefined;
Gets the source file referenced in the external module reference or returns undefined if it doesn't exist.
method getExternalModuleReferenceSourceFileOrThrow
getExternalModuleReferenceSourceFileOrThrow: ( message?: string | (() => string)) => SourceFile;
Gets the source file referenced in the external module reference or throws if it doesn't exist.
method getModuleReference
getModuleReference: () => ModuleReference;
Gets the module reference of the import equals declaration.
method getParent
getParent: () => NodeParentType<ts.ImportEqualsDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ImportEqualsDeclaration>>;
*
method isExternalModuleReferenceRelative
isExternalModuleReferenceRelative: () => boolean;
Gets if the external module reference is relative.
method isTypeOnly
isTypeOnly: () => boolean;
Gets if this import equals declaration is type only.
method setExternalModuleReference
setExternalModuleReference: { (externalModuleReference: string): this; (sourceFile: SourceFile): this;};
Sets the external module reference.
Parameter externalModuleReference
External module reference as a string.
Sets the external module reference.
Parameter sourceFile
Source file to set the external module reference to.
method setIsTypeOnly
setIsTypeOnly: (value: boolean) => this;
Sets if this import equals declaration is type only.
class ImportExpression
class ImportExpression extends ImportExpressionBase<ts.ImportExpression> {}
method getParent
getParent: () => NodeParentType<ts.ImportExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ImportExpression>>;
*
class ImportSpecifier
class ImportSpecifier extends ImportSpecifierBase<ts.ImportSpecifier> {}
method getAliasNode
getAliasNode: () => Identifier | undefined;
Gets the alias identifier, if it exists.
method getImportDeclaration
getImportDeclaration: () => ImportDeclaration;
Gets the import declaration associated with this import specifier.
method getName
getName: () => string;
Gets the name of the import specifier.
method getNameNode
getNameNode: () => StringLiteral | Identifier;
Gets the name node of what's being imported.
method getParent
getParent: () => NodeParentType<ts.ImportSpecifier>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ImportSpecifier>>;
*
method getStructure
getStructure: () => ImportSpecifierStructure;
Gets the structure equivalent to this node.
method isTypeOnly
isTypeOnly: () => boolean;
Gets if this is a type only import specifier.
method remove
remove: () => void;
Remove the import specifier.
method removeAlias
removeAlias: () => this;
Removes the alias without renaming.
Remarks
Use removeAliasWithRename() if you want it to rename any usages to the name of the import specifier.
method removeAliasWithRename
removeAliasWithRename: () => this;
Removes the alias and renames any usages to the name of the import specifier.
method renameAlias
renameAlias: (alias: string) => this;
Sets the alias for the name being imported and renames all the usages.
Parameter alias
Alias to set.
method set
set: (structure: Partial<ImportSpecifierStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setAlias
setAlias: (alias: string) => this;
Sets the alias without renaming all the usages.
Parameter alias
Alias to set.
method setIsTypeOnly
setIsTypeOnly: (value: boolean) => this;
Sets if this is a type only import specifier.
method setName
setName: (name: string) => this;
Sets the identifier being imported.
Parameter name
Name being imported.
class ImportTypeNode
class ImportTypeNode extends NodeWithTypeArguments<ts.ImportTypeNode> {}
method getArgument
getArgument: () => TypeNode;
Gets the argument passed into the import type.
method getAttributes
getAttributes: () => ImportAttributes | undefined;
Gets the import attributes container if it exists.
method getAttributesOrThrow
getAttributesOrThrow: (message?: string | (() => string)) => ImportAttributes;
Gets the import attributes container if it exists or throws.
method getParent
getParent: () => NodeParentType<ts.ImportTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ImportTypeNode>>;
*
method getQualifier
getQualifier: () => EntityName | undefined;
Gets the qualifier of the import type if it exists or returns undefined.
method getQualifierOrThrow
getQualifierOrThrow: (message?: string | (() => string)) => EntityName;
Gets the qualifier of the import type if it exists or throws
method setArgument
setArgument: (text: string) => this;
Sets the argument text.
Parameter text
Text of the argument.
method setQualifier
setQualifier: (text: string) => this;
Sets the qualifier text.
Parameter text
Text.
class IndexedAccessTypeNode
class IndexedAccessTypeNode extends TypeNode<ts.IndexedAccessTypeNode> {}
method getIndexTypeNode
getIndexTypeNode: () => TypeNode;
Gets the indexed access type node's index type node.
This is
"myIndex"
inMyObjectType["myIndex"]
.
method getObjectTypeNode
getObjectTypeNode: () => TypeNode;
Gets the indexed access type node's object type node.
This is
MyObjectType
inMyObjectType["myIndex"]
.
method getParent
getParent: () => NodeParentType<ts.IndexedAccessTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.IndexedAccessTypeNode>>;
*
class IndexSignatureDeclaration
class IndexSignatureDeclaration extends IndexSignatureDeclarationBase<ts.IndexSignatureDeclaration> {}
method getKeyName
getKeyName: () => string;
Gets the key name.
method getKeyNameNode
getKeyNameNode: () => BindingName;
Gets the key name node.
method getKeyType
getKeyType: () => Type;
Gets the key type.
method getKeyTypeNode
getKeyTypeNode: () => TypeNode;
Gets the key type node.
method getParent
getParent: () => NodeParentType<ts.IndexSignatureDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.IndexSignatureDeclaration>>;
*
method getStructure
getStructure: () => IndexSignatureDeclarationStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<IndexSignatureDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setKeyName
setKeyName: (name: string) => void;
Sets the key name.
Parameter name
New name.
method setKeyType
setKeyType: (type: string) => this;
Sets the key type.
Parameter type
Type.
class InferTypeNode
class InferTypeNode extends TypeNode<ts.InferTypeNode> {}
method getParent
getParent: () => NodeParentType<ts.InferTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.InferTypeNode>>;
*
method getTypeParameter
getTypeParameter: () => TypeParameterDeclaration;
Gets the infer type node's type parameter.
Ex. In
infer R
returnsR
.
class InMemoryFileSystemHost
class InMemoryFileSystemHost implements FileSystemHost {}
An implementation of a file system that exists in memory only.
constructor
constructor();
Constructor.
method copy
copy: (srcPath: string, destPath: string) => Promise<void>;
method copySync
copySync: (srcPath: string, destPath: string) => void;
method delete
delete: (path: string) => Promise<void>;
method deleteSync
deleteSync: (path: string) => void;
method directoryExists
directoryExists: (dirPath: string) => Promise<boolean>;
method directoryExistsSync
directoryExistsSync: (dirPath: string) => boolean;
method fileExists
fileExists: (filePath: string) => Promise<boolean>;
method fileExistsSync
fileExistsSync: (filePath: string) => boolean;
method getCurrentDirectory
getCurrentDirectory: () => string;
method glob
glob: (patterns: ReadonlyArray<string>) => Promise<string[]>;
method globSync
globSync: (patterns: ReadonlyArray<string>) => string[];
method isCaseSensitive
isCaseSensitive: () => boolean;
method mkdir
mkdir: (dirPath: string) => Promise<void>;
method mkdirSync
mkdirSync: (dirPath: string) => void;
method move
move: (srcPath: string, destPath: string) => Promise<void>;
method moveSync
moveSync: (srcPath: string, destPath: string) => void;
method readDirSync
readDirSync: (dirPath: string) => RuntimeDirEntry[];
method readFile
readFile: (filePath: string, encoding?: string) => Promise<string>;
method readFileSync
readFileSync: (filePath: string, encoding?: string) => string;
method realpathSync
realpathSync: (path: string) => string;
method writeFile
writeFile: (filePath: string, fileText: string) => Promise<void>;
method writeFileSync
writeFileSync: (filePath: string, fileText: string) => void;
class InterfaceDeclaration
class InterfaceDeclaration extends InterfaceDeclarationBase<ts.InterfaceDeclaration> {}
method getBaseDeclarations
getBaseDeclarations: () => ( | TypeAliasDeclaration | InterfaceDeclaration | ClassDeclaration)[];
Gets the base declarations.
method getBaseTypes
getBaseTypes: () => Type[];
Gets the base types.
method getImplementations
getImplementations: () => ImplementationLocation[];
Gets all the implementations of the interface.
This is similar to "go to implementation."
method getParent
getParent: () => NodeParentType<ts.InterfaceDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.InterfaceDeclaration>>;
*
method getStructure
getStructure: () => InterfaceDeclarationStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<InterfaceDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class IntersectionTypeNode
class IntersectionTypeNode extends TypeNode<ts.IntersectionTypeNode> {}
method getParent
getParent: () => NodeParentType<ts.IntersectionTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.IntersectionTypeNode>>;
*
method getTypeNodes
getTypeNodes: () => TypeNode[];
Gets the intersection type nodes.
class IterationStatement
class IterationStatement< T extends ts.IterationStatement = ts.IterationStatement> extends Statement<T> {}
method getStatement
getStatement: () => Statement;
Gets this iteration statement's statement.
class JSDoc
class JSDoc extends JSDocBase<ts.JSDoc> {}
JS doc node.
method addTag
addTag: (structure: OptionalKind<JSDocTagStructure>) => JSDocTag<ts.JSDocTag>;
Adds a JS doc tag.
Parameter structure
Tag structure to add.
method addTags
addTags: ( structures: ReadonlyArray<OptionalKind<JSDocTagStructure>>) => JSDocTag<ts.JSDocTag>[];
Adds JS doc tags.
Parameter structures
Tag structures to add.
method getComment
getComment: () => | string | (JSDocText | JSDocLink | JSDocLinkCode | JSDocLinkPlain | undefined)[] | undefined;
Gets the comment property. Use
#getCommentText()
to get the text of the JS doc comment if necessary.
method getCommentText
getCommentText: () => string | undefined;
Gets the text of the JS doc comment.
method getDescription
getDescription: () => string;
Gets the description from the JS doc comment.
Remarks
This will contain a leading newline if the jsdoc is multi-line.
method getInnerText
getInnerText: () => string;
Gets the JSDoc's text without the surrounding slashes and stars.
method getParent
getParent: () => NodeParentType<ts.JSDoc>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDoc>>;
*
method getStructure
getStructure: () => JSDocStructure;
Gets the structure equivalent to this node.
method getTags
getTags: () => JSDocTag[];
Gets the tags of the JSDoc.
method insertTag
insertTag: ( index: number, structure: OptionalKind<JSDocTagStructure>) => JSDocTag<ts.JSDocTag>;
Inserts a JS doc tag at the specified index.
Parameter index
Index to insert at.
Parameter structure
Tag structure to insert.
method insertTags
insertTags: ( index: number, structures: ReadonlyArray<OptionalKind<JSDocTagStructure>>) => JSDocTag<ts.JSDocTag>[];
Inserts JS doc tags at the specified index.
Parameter index
Index to insert at.
Parameter structures
Tag structures to insert.
method isMultiLine
isMultiLine: () => boolean;
Gets if this JS doc spans multiple lines.
method remove
remove: () => void;
Removes this JSDoc.
method set
set: (structure: Partial<JSDocStructure>) => Node<ts.Node>;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setDescription
setDescription: (textOrWriterFunction: string | WriterFunction) => this;
Sets the description.
Parameter textOrWriterFunction
Text or writer function to set.
class JSDocAllType
class JSDocAllType extends JSDocType<ts.JSDocAllType> {}
JS doc all type.
method getParent
getParent: () => NodeParentType<ts.JSDocAllType>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocAllType>>;
*
class JSDocAugmentsTag
class JSDocAugmentsTag extends JSDocTag<ts.JSDocAugmentsTag> {}
JS doc augments tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocAugmentsTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocAugmentsTag>>;
*
class JSDocAuthorTag
class JSDocAuthorTag extends JSDocTag<ts.JSDocAuthorTag> {}
JS doc author tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocAuthorTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocAuthorTag>>;
*
class JSDocCallbackTag
class JSDocCallbackTag extends JSDocTag<ts.JSDocCallbackTag> {}
JS doc callback tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocCallbackTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocCallbackTag>>;
*
class JSDocClassTag
class JSDocClassTag extends JSDocTag<ts.JSDocClassTag> {}
JS doc class tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocClassTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocClassTag>>;
*
class JSDocDeprecatedTag
class JSDocDeprecatedTag extends JSDocTag<ts.JSDocDeprecatedTag> {}
JS doc deprecated tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocDeprecatedTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocDeprecatedTag>>;
*
class JSDocEnumTag
class JSDocEnumTag extends JSDocTag<ts.JSDocEnumTag> {}
JS doc enum tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocEnumTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocEnumTag>>;
*
class JSDocFunctionType
class JSDocFunctionType extends JSDocFunctionTypeBase<ts.JSDocFunctionType> {}
JS doc function type.
method getParent
getParent: () => NodeParentType<ts.JSDocFunctionType>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocFunctionType>>;
*
class JSDocImplementsTag
class JSDocImplementsTag extends JSDocTag<ts.JSDocImplementsTag> {}
JS doc implements tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocImplementsTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocImplementsTag>>;
*
class JSDocLink
class JSDocLink extends Node<ts.JSDocLink> {}
JS doc link node.
method getParent
getParent: () => NodeParentType<ts.JSDocLink>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocLink>>;
*
class JSDocLinkCode
class JSDocLinkCode extends Node<ts.JSDocLinkCode> {}
JS doc link code node.
method getParent
getParent: () => NodeParentType<ts.JSDocLinkCode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocLinkCode>>;
*
class JSDocLinkPlain
class JSDocLinkPlain extends Node<ts.JSDocLinkPlain> {}
JS doc link plain node.
method getParent
getParent: () => NodeParentType<ts.JSDocLinkPlain>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocLinkPlain>>;
*
class JSDocMemberName
class JSDocMemberName extends Node<ts.JSDocMemberName> {}
JS doc member name node.
method getParent
getParent: () => NodeParentType<ts.JSDocMemberName>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocMemberName>>;
*
class JSDocNamepathType
class JSDocNamepathType extends JSDocType<ts.JSDocNamepathType> {}
JS doc namepath type.
method getParent
getParent: () => NodeParentType<ts.JSDocNamepathType>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocNamepathType>>;
*
method getTypeNode
getTypeNode: () => TypeNode<ts.TypeNode>;
Gets the type node of the JS doc namepath node.
class JSDocNameReference
class JSDocNameReference extends Node<ts.JSDocNameReference> {}
JS doc name reference.
method getName
getName: () => Identifier | QualifiedName | JSDocMemberName;
Gets the name of the JS doc name reference.
method getParent
getParent: () => NodeParentType<ts.JSDocNameReference>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocNameReference>>;
*
class JSDocNonNullableType
class JSDocNonNullableType extends JSDocType<ts.JSDocNonNullableType> {}
JS doc non-nullable type.
method getParent
getParent: () => NodeParentType<ts.JSDocNonNullableType>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocNonNullableType>>;
*
method getTypeNode
getTypeNode: () => TypeNode<ts.TypeNode>;
Gets the type node of the JS doc non-nullable type node.
method isPostfix
isPostfix: () => boolean;
class JSDocNullableType
class JSDocNullableType extends JSDocType<ts.JSDocNullableType> {}
JS doc nullable type.
method getParent
getParent: () => NodeParentType<ts.JSDocNullableType>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocNullableType>>;
*
method getTypeNode
getTypeNode: () => TypeNode<ts.TypeNode>;
Gets the type node of the JS doc nullable type node.
method isPostfix
isPostfix: () => boolean;
class JSDocOptionalType
class JSDocOptionalType extends JSDocType<ts.JSDocOptionalType> {}
JS doc optional type.
method getParent
getParent: () => NodeParentType<ts.JSDocOptionalType>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocOptionalType>>;
*
method getTypeNode
getTypeNode: () => TypeNode<ts.TypeNode>;
Gets the type node of the JS doc optional type node.
class JSDocOverloadTag
class JSDocOverloadTag extends JSDocOverloadTagBase<ts.JSDocOverloadTag> {}
JS doc overload tag.
method getParent
getParent: () => NodeParentType<ts.JSDocOverloadTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocOverloadTag>>;
*
class JSDocOverrideTag
class JSDocOverrideTag extends JSDocTag<ts.JSDocOverrideTag> {}
JS doc override tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocOverrideTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocOverrideTag>>;
*
class JSDocParameterTag
class JSDocParameterTag extends JSDocParameterTagBase<ts.JSDocParameterTag> {}
JS doc parameter tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocParameterTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocParameterTag>>;
*
class JSDocPrivateTag
class JSDocPrivateTag extends JSDocTag<ts.JSDocPrivateTag> {}
JS doc private tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocPrivateTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocPrivateTag>>;
*
class JSDocPropertyTag
class JSDocPropertyTag extends JSDocPropertyTagBase<ts.JSDocPropertyTag> {}
JS doc property tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocPropertyTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocPropertyTag>>;
*
class JSDocProtectedTag
class JSDocProtectedTag extends JSDocTag<ts.JSDocProtectedTag> {}
JS doc protected tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocProtectedTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocProtectedTag>>;
*
class JSDocPublicTag
class JSDocPublicTag extends JSDocTag<ts.JSDocPublicTag> {}
JS doc public tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocPublicTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocPublicTag>>;
*
class JSDocReadonlyTag
class JSDocReadonlyTag extends JSDocTag<ts.JSDocReadonlyTag> {}
JS doc readonly tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocReadonlyTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocReadonlyTag>>;
*
class JSDocReturnTag
class JSDocReturnTag extends JSDocReturnTagBase<ts.JSDocReturnTag> {}
JS doc return tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocReturnTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocReturnTag>>;
*
class JSDocSatisfiesTag
class JSDocSatisfiesTag extends JSDocSatisfiesTagBase<ts.JSDocSatisfiesTag> {}
JS doc satifiest tag.
method getParent
getParent: () => NodeParentType<ts.JSDocSatisfiesTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocSatisfiesTag>>;
*
class JSDocSeeTag
class JSDocSeeTag extends JSDocSeeTagBase<ts.JSDocSeeTag> {}
JS doc "see" tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocSeeTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocSeeTag>>;
*
class JSDocSignature
class JSDocSignature extends JSDocType<ts.JSDocSignature> {}
JS doc signature node.
method getParent
getParent: () => NodeParentType<ts.JSDocSignature>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocSignature>>;
*
method getTypeNode
getTypeNode: () => JSDocReturnTag | undefined;
Gets the type node of the JS doc signature.
class JSDocTag
class JSDocTag< NodeType extends ts.JSDocTag = ts.JSDocTag> extends JSDocTagBase<NodeType> {}
JS doc tag node.
method getComment
getComment: () => | string | (JSDocText | JSDocLink | JSDocLinkCode | JSDocLinkPlain | undefined)[] | undefined;
Gets the tag's comment property. Use
#getCommentText()
to get the text of the JS doc tag comment if necessary.
method getCommentText
getCommentText: () => string | undefined;
Gets the text of the JS doc tag comment (ex.
"Some description."
for@param value Some description.
).
method getStructure
getStructure: () => JSDocTagStructure;
Gets a structure that represents this JS doc tag node.
method getTagName
getTagName: () => string;
Gets the tag's name as a string (ex. returns
"param"
for@param
).
method getTagNameNode
getTagNameNode: () => Identifier;
Gets the tag name node (ex. Returns the
param
identifier for@param
).
method remove
remove: () => void;
Removes the JS doc comment.
method replaceWithText
replaceWithText: (textOrWriterFunction: string | WriterFunction) => Node;
method set
set: (structure: Partial<JSDocTagStructure>) => Node<ts.Node>;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
Returns
The node or the node that replaced the existing node (ex. when changing from a JSDocParameterTag to something else).
method setTagName
setTagName: (tagName: string) => Node<ts.Node>;
Sets the tag name.
Parameter tagName
The new name to use.
Returns
The current node or new node if the node kind changed.
Remarks
This will forget the current node if the JSDocTag kind changes. Use the return value if you're changing the kind.
class JSDocTagInfo
class JSDocTagInfo {}
JS doc tag info.
property compilerObject
readonly compilerObject: ts.JSDocTagInfo;
Gets the compiler JS doc tag info.
method getName
getName: () => string;
Gets the name.
method getText
getText: () => ts.SymbolDisplayPart[];
Gets the text.
class JSDocTemplateTag
class JSDocTemplateTag extends JSDocTemplateTagBase<ts.JSDocTemplateTag> {}
JS doc template tag node.
method getConstraint
getConstraint: () => JSDocTypeExpression | undefined;
Gets the template tag's constraint if it exists or returns undefined.
method getConstraintOrThrow
getConstraintOrThrow: (message?: string | (() => string)) => JSDocTypeExpression;
Gets the template tag's constraint if it exists or throws otherwise.
method getParent
getParent: () => NodeParentType<ts.JSDocTemplateTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocTemplateTag>>;
*
class JSDocText
class JSDocText extends Node<ts.JSDocText> {}
JS doc text node.
method getParent
getParent: () => NodeParentType<ts.JSDocText>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocText>>;
*
class JSDocThisTag
class JSDocThisTag extends JSDocThisTagBase<ts.JSDocThisTag> {}
JS doc "this" tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocThisTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocThisTag>>;
*
class JSDocThrowsTag
class JSDocThrowsTag extends JSDocThrowsTagBase<ts.JSDocThrowsTag> {}
JS doc return tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocThrowsTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocThrowsTag>>;
*
class JSDocType
class JSDocType<T extends ts.JSDocType = ts.JSDocType> extends TypeNode<T> {}
JS doc type node.
class JSDocTypedefTag
class JSDocTypedefTag extends JSDocTag<ts.JSDocTypedefTag> {}
JS doc type def tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocTypedefTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocTypedefTag>>;
*
class JSDocTypeExpression
class JSDocTypeExpression extends TypeNode<ts.JSDocTypeExpression> {}
JS doc type expression node.
method getParent
getParent: () => NodeParentType<ts.JSDocTypeExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocTypeExpression>>;
*
method getTypeNode
getTypeNode: () => TypeNode<ts.TypeNode>;
Gets the type node of the JS doc type expression.
class JSDocTypeLiteral
class JSDocTypeLiteral extends JSDocType<ts.JSDocTypeLiteral> {}
JS doc type literal.
method getParent
getParent: () => NodeParentType<ts.JSDocTypeLiteral>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocTypeLiteral>>;
*
method getPropertyTags
getPropertyTags: () => JSDocTag<ts.JSDocTag>[] | undefined;
Gets the JS doc property tags if they exist.
method isArrayType
isArrayType: () => boolean;
Gets if it's an array type.
class JSDocTypeTag
class JSDocTypeTag extends JSDocTag<ts.JSDocTypeTag> {}
JS doc type tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocTypeTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocTypeTag>>;
*
method getTypeExpression
getTypeExpression: () => JSDocTypeExpression | undefined;
Gets the type expression node of the JS doc property type tag.
class JSDocUnknownTag
class JSDocUnknownTag extends JSDocTag<ts.JSDocUnknownTag> {}
JS doc unknown tag node.
method getParent
getParent: () => NodeParentType<ts.JSDocUnknownTag>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocUnknownTag>>;
*
class JSDocUnknownType
class JSDocUnknownType extends JSDocType<ts.JSDocUnknownType> {}
JS doc unknown type.
method getParent
getParent: () => NodeParentType<ts.JSDocUnknownType>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocUnknownType>>;
*
class JSDocVariadicType
class JSDocVariadicType extends JSDocType<ts.JSDocVariadicType> {}
JS doc variadic type.
method getParent
getParent: () => NodeParentType<ts.JSDocVariadicType>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JSDocVariadicType>>;
*
method getTypeNode
getTypeNode: () => TypeNode<ts.TypeNode>;
Gets the type node of the JS doc variadic type node.
class JsxAttribute
class JsxAttribute extends JsxAttributeBase<ts.JsxAttribute> {}
method getInitializer
getInitializer: () => | JsxElement | JsxExpression | JsxFragment | JsxSelfClosingElement | StringLiteral | undefined;
Gets the JSX attribute's initializer or returns undefined if it doesn't exist.
method getInitializerOrThrow
getInitializerOrThrow: ( message?: string | (() => string)) => | StringLiteral | JsxElement | JsxSelfClosingElement | JsxFragment | JsxExpression;
Gets the JSX attribute's initializer or throws if it doesn't exist.
method getNameNode
getNameNode: () => JsxAttributeName;
Gets the name node of the JSX attribute.
method getParent
getParent: () => NodeParentType<ts.JsxAttribute>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxAttribute>>;
*
method getStructure
getStructure: () => JsxAttributeStructure;
Gets the structure equivalent to this node.
method remove
remove: () => void;
Removes the JSX attribute.
method removeInitializer
removeInitializer: () => this;
Removes the initializer.
method set
set: (structure: Partial<JsxAttributeStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setInitializer
setInitializer: (textOrWriterFunction: string | WriterFunction) => this;
Sets the initializer.
Parameter textOrWriterFunction
Text or writer function to set the initializer with.
Remarks
You need to provide the quotes or braces.
method setName
setName: (name: string | JsxNamespacedNameStructure) => this;
Sets the name of the JSX attribute.
class JsxClosingElement
class JsxClosingElement extends JsxClosingElementBase<ts.JsxClosingElement> {}
method getParent
getParent: () => NodeParentType<ts.JsxClosingElement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxClosingElement>>;
*
class JsxClosingFragment
class JsxClosingFragment extends Expression<ts.JsxClosingFragment> {}
method getParent
getParent: () => NodeParentType<ts.JsxClosingFragment>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxClosingFragment>>;
*
class JsxElement
class JsxElement extends JsxElementBase<ts.JsxElement> {}
method getClosingElement
getClosingElement: () => JsxClosingElement;
Gets the closing element.
method getJsxChildren
getJsxChildren: () => JsxChild[];
Gets the children of the JSX element.
method getOpeningElement
getOpeningElement: () => JsxOpeningElement;
Gets the opening element.
method getParent
getParent: () => NodeParentType<ts.JsxElement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxElement>>;
*
method getStructure
getStructure: () => JsxElementStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<JsxElementStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setBodyText
setBodyText: (textOrWriterFunction: string | WriterFunction) => this;
Sets the body text.
Parameter textOrWriterFunction
Text or writer function to set as the body.
method setBodyTextInline
setBodyTextInline: (textOrWriterFunction: string | WriterFunction) => this;
Sets the body text without surrounding new lines.
Parameter textOrWriterFunction
Text to set as the body.
class JsxExpression
class JsxExpression extends JsxExpressionBase<ts.JsxExpression> {}
method getParent
getParent: () => NodeParentType<ts.JsxExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxExpression>>;
*
class JsxFragment
class JsxFragment extends PrimaryExpression<ts.JsxFragment> {}
method getClosingFragment
getClosingFragment: () => JsxClosingFragment;
Gets the closing fragment.
method getJsxChildren
getJsxChildren: () => JsxChild[];
Gets the children of the JSX fragment.
method getOpeningFragment
getOpeningFragment: () => JsxOpeningFragment;
Gets the opening fragment.
method getParent
getParent: () => NodeParentType<ts.JsxFragment>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxFragment>>;
*
class JsxNamespacedName
class JsxNamespacedName extends JsxNamespacedNameBase<ts.JsxNamespacedName> {}
method getNameNode
getNameNode: () => Identifier;
Gets the name node.
method getNamespaceNode
getNamespaceNode: () => Identifier;
Gets the namespace name node.
method getParent
getParent: () => NodeParentType<ts.JsxNamespacedName>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxNamespacedName>>;
*
method getStructure
getStructure: () => JsxNamespacedNameStructure;
method set
set: (structure: JsxNamespacedNameStructure) => this;
class JsxOpeningElement
class JsxOpeningElement extends JsxOpeningElementBase<ts.JsxOpeningElement> {}
method getParent
getParent: () => NodeParentType<ts.JsxOpeningElement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxOpeningElement>>;
*
class JsxOpeningFragment
class JsxOpeningFragment extends Expression<ts.JsxOpeningFragment> {}
method getParent
getParent: () => NodeParentType<ts.JsxOpeningFragment>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxOpeningFragment>>;
*
class JsxSelfClosingElement
class JsxSelfClosingElement extends JsxSelfClosingElementBase<ts.JsxSelfClosingElement> {}
method getParent
getParent: () => NodeParentType<ts.JsxSelfClosingElement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxSelfClosingElement>>;
*
method getStructure
getStructure: () => JsxSelfClosingElementStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<JsxSelfClosingElementStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class JsxSpreadAttribute
class JsxSpreadAttribute extends JsxSpreadAttributeBase<ts.JsxSpreadAttribute> {}
method getParent
getParent: () => NodeParentType<ts.JsxSpreadAttribute>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxSpreadAttribute>>;
*
method getStructure
getStructure: () => JsxSpreadAttributeStructure;
Gets the structure equivalent to this node.
method remove
remove: () => void;
Removes the JSX spread attribute.
method set
set: (structure: Partial<JsxSpreadAttributeStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class JsxText
class JsxText extends JsxTextBase<ts.JsxText> {}
method containsOnlyTriviaWhiteSpaces
containsOnlyTriviaWhiteSpaces: () => boolean;
Gets if the JSX text contains only white spaces.
method getParent
getParent: () => NodeParentType<ts.JsxText>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.JsxText>>;
*
class LabeledStatement
class LabeledStatement extends LabeledStatementBase<ts.LabeledStatement> {}
method getLabel
getLabel: () => Identifier;
Gets this labeled statement's label
method getParent
getParent: () => NodeParentType<ts.LabeledStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.LabeledStatement>>;
*
method getStatement
getStatement: () => Statement;
Gets this labeled statement's statement
class LanguageService
class LanguageService {}
property compilerObject
readonly compilerObject: ts.LanguageService;
Gets the compiler language service.
method findReferences
findReferences: (node: Node) => ReferencedSymbol[];
Finds references based on the specified node.
Parameter node
Node to find references for.
method findReferencesAsNodes
findReferencesAsNodes: (node: Node) => Node<ts.Node>[];
Finds the nodes that reference the definition(s) of the specified node.
Parameter node
Node.
method findReferencesAtPosition
findReferencesAtPosition: ( sourceFile: SourceFile, pos: number) => ReferencedSymbol[];
Finds references based on the specified position.
Parameter sourceFile
Source file.
Parameter pos
Position to find the reference at.
method findRenameLocations
findRenameLocations: (node: Node, options?: RenameOptions) => RenameLocation[];
Find the rename locations for the specified node.
Parameter node
Node to get the rename locations for.
Parameter options
Options for renaming.
method getCodeFixesAtPosition
getCodeFixesAtPosition: ( filePathOrSourceFile: string | SourceFile, start: number, end: number, errorCodes: ReadonlyArray<number>, formatOptions?: FormatCodeSettings, preferences?: UserPreferences) => CodeFixAction[];
Gets the edit information for applying a code fix at the provided text range in a source file.
Parameter filePathOrSourceFile
File path or source file to get the code fixes for.
Parameter start
Start position of the text range to be fixed.
Parameter end
End position of the text range to be fixed.
Parameter errorCodes
One or more error codes associated with the code fixes to retrieve.
Parameter formatOptions
Format code settings.
Parameter preferences
User preferences for refactoring.
method getCombinedCodeFix
getCombinedCodeFix: ( filePathOrSourceFile: string | SourceFile, fixId: {}, formatSettings?: FormatCodeSettings, preferences?: UserPreferences) => CombinedCodeActions;
Gets file changes and actions to perform for the provided fixId.
Parameter filePathOrSourceFile
File path or source file to get the combined code fixes for.
Parameter fixId
Identifier for the code fix (ex. "fixMissingImport"). These ids are found in the
ts.codefix
namespace in the compiler api source.Parameter formatSettings
Format code settings.
Parameter preferences
User preferences for refactoring.
method getDefinitions
getDefinitions: (node: Node) => DefinitionInfo[];
Gets the definitions for the specified node.
Parameter node
Node.
method getDefinitionsAtPosition
getDefinitionsAtPosition: ( sourceFile: SourceFile, pos: number) => DefinitionInfo[];
Gets the definitions at the specified position.
Parameter sourceFile
Source file.
Parameter pos
Position.
method getEditsForRefactor
getEditsForRefactor: ( filePathOrSourceFile: string | SourceFile, formatSettings: FormatCodeSettings, positionOrRange: number | { getPos(): number; getEnd(): number }, refactorName: string, actionName: string, preferences?: UserPreferences) => RefactorEditInfo | undefined;
Gets the edit information for applying a refactor at a the provided position in a source file.
Parameter filePathOrSourceFile
File path or source file to get the edits for.
Parameter formatSettings
Fomat code settings.
Parameter positionOrRange
Position in the source file where to apply given refactor.
Parameter refactorName
Refactor name.
Parameter actionName
Refactor action name.
Parameter preferences
User preferences for refactoring.
method getEmitOutput
getEmitOutput: { (sourceFile: SourceFile, emitOnlyDtsFiles?: boolean): EmitOutput; (filePath: string, emitOnlyDtsFiles?: boolean): EmitOutput;};
Gets the emit output of a source file.
Parameter sourceFile
Source file.
Parameter emitOnlyDtsFiles
Whether to only emit the d.ts files.
Gets the emit output of a source file.
Parameter filePath
File path.
Parameter emitOnlyDtsFiles
Whether to only emit the d.ts files.
method getFormattedDocumentText
getFormattedDocumentText: ( filePath: string, formatSettings: FormatCodeSettings) => string;
Gets the formatted text for a document.
Parameter filePath
File path of the source file.
Parameter formatSettings
Format code settings.
method getFormattingEditsForDocument
getFormattingEditsForDocument: ( filePath: string, formatSettings: FormatCodeSettings) => TextChange[];
Gets the formatting edits for a document.
Parameter filePath
File path of the source file.
Parameter formatSettings
Format code settings.
method getFormattingEditsForRange
getFormattingEditsForRange: ( filePath: string, range: [number, number], formatSettings: FormatCodeSettings) => TextChange[];
Gets the formatting edits for a range.
Parameter filePath
File path.
Parameter range
Position range.
Parameter formatSettings
Format code settings.
method getIdentationAtPosition
getIdentationAtPosition: { ( sourceFile: SourceFile, position: number, settings?: EditorSettings ): number; (filePath: string, position: number, settings?: EditorSettings): number;};
Gets the indentation at the specified position.
Parameter sourceFile
Source file.
Parameter position
Position.
Parameter settings
Editor settings.
Gets the indentation at the specified position.
Parameter filePath
File path.
Parameter position
Position.
Parameter settings
Editor settings.
method getImplementations
getImplementations: (node: Node) => ImplementationLocation[];
Gets the implementations for the specified node.
Parameter node
Node.
method getImplementationsAtPosition
getImplementationsAtPosition: ( sourceFile: SourceFile, pos: number) => ImplementationLocation[];
Gets the implementations at the specified position.
Parameter sourceFile
Source file.
Parameter pos
Position.
method getProgram
getProgram: () => Program;
Gets the language service's program.
method getSuggestionDiagnostics
getSuggestionDiagnostics: ( filePathOrSourceFile: SourceFile | string) => DiagnosticWithLocation[];
Gets the suggestion diagnostics.
Parameter filePathOrSourceFile
The source file or file path to get suggestions for.
method organizeImports
organizeImports: { ( sourceFile: SourceFile, formatSettings?: FormatCodeSettings, userPreferences?: UserPreferences ): FileTextChanges[]; ( filePath: string, formatSettings?: FormatCodeSettings, userPreferences?: UserPreferences ): FileTextChanges[];};
Gets the file text changes for organizing the imports in a source file.
Parameter sourceFile
Source file.
Parameter formatSettings
Format code settings.
Parameter userPreferences
User preferences for refactoring.
Gets the file text changes for organizing the imports in a source file.
Parameter filePath
File path of the source file.
Parameter formatSettings
Format code settings.
Parameter userPreferences
User preferences for refactoring.
class LeftHandSideExpression
class LeftHandSideExpression< T extends ts.LeftHandSideExpression = ts.LeftHandSideExpression> extends UpdateExpression<T> {}
class LiteralExpression
class LiteralExpression< T extends ts.LiteralExpression = ts.LiteralExpression> extends LiteralExpressionBase<T> {}
class LiteralTypeNode
class LiteralTypeNode extends TypeNode<ts.LiteralTypeNode> {}
method getLiteral
getLiteral: () => | NullLiteral | BooleanLiteral | LiteralExpression | PrefixUnaryExpression;
Gets the literal type node's literal.
method getParent
getParent: () => NodeParentType<ts.LiteralTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.LiteralTypeNode>>;
*
class ManipulationError
class ManipulationError extends errors.InvalidOperationError {}
Occurs when there is a problem doing a manipulation.
constructor
constructor( filePath: string, oldText: string, newText: string, errorMessage: string);
property filePath
readonly filePath: string;
property newText
readonly newText: string;
property oldText
readonly oldText: string;
class ManipulationSettingsContainer
class ManipulationSettingsContainer extends SettingsContainer<ManipulationSettings> {}
Holds the manipulation settings.
constructor
constructor();
method getEditorSettings
getEditorSettings: () => EditorSettings;
Gets the editor settings based on the current manipulation settings.
method getFormatCodeSettings
getFormatCodeSettings: () => Readonly<SupportedFormatCodeSettings>;
Gets the format code settings.
method getIndentationText
getIndentationText: () => IndentationText;
Gets the indentation text.
method getNewLineKind
getNewLineKind: () => NewLineKind;
Gets the new line kind.
method getNewLineKindAsString
getNewLineKindAsString: () => '\r\n' | '\n';
Gets the new line kind as a string.
method getQuoteKind
getQuoteKind: () => QuoteKind;
Gets the quote kind used for string literals.
method getUsePrefixAndSuffixTextForRename
getUsePrefixAndSuffixTextForRename: () => boolean;
Gets whether to use prefix and suffix text when renaming.
method getUserPreferences
getUserPreferences: () => Readonly<UserPreferences>;
Gets the user preferences.
method getUseTrailingCommas
getUseTrailingCommas: () => boolean;
Gets whether trailing commas should be used.
method set
set: (settings: Partial<ManipulationSettings>) => void;
Sets one or all of the settings.
Parameter settings
Settings to set.
class MappedTypeNode
class MappedTypeNode extends TypeNode<ts.MappedTypeNode> {}
method getNameTypeNode
getNameTypeNode: () => TypeNode | undefined;
Gets the mapped type node's name type node if any.
method getNameTypeNodeOrThrow
getNameTypeNodeOrThrow: (message?: string | (() => string)) => TypeNode;
Gets the mapped type node's name type node or throws if it doesn't exist.
method getParent
getParent: () => NodeParentType<ts.MappedTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.MappedTypeNode>>;
*
method getQuestionToken
getQuestionToken: () => | Node<ts.QuestionToken> | Node<ts.PlusToken> | Node<ts.MinusToken> | undefined;
Gets the mapped type's question token.
method getQuestionTokenOrThrow
getQuestionTokenOrThrow: ( message?: string | (() => string)) => Node<ts.QuestionToken> | Node<ts.PlusToken> | Node<ts.MinusToken>;
Gets the mapped type's question token or throws if not exist.
method getReadonlyToken
getReadonlyToken: () => | Node<ts.ReadonlyKeyword> | Node<ts.PlusToken> | Node<ts.MinusToken> | undefined;
Gets the mapped type's readonly token.
method getReadonlyTokenOrThrow
getReadonlyTokenOrThrow: ( message?: string | (() => string)) => Node<ts.ReadonlyKeyword> | Node<ts.PlusToken> | Node<ts.MinusToken>;
Gets the mapped type's readonly token or throws if not exist.
method getTypeNode
getTypeNode: () => TypeNode | undefined;
Gets the mapped type node's type node if it exists or returns undefined when not.
method getTypeNodeOrThrow
getTypeNodeOrThrow: (message?: string | (() => string)) => TypeNode;
Gets the mapped type node's type node if it exists or throws when undefined.
method getTypeParameter
getTypeParameter: () => TypeParameterDeclaration;
Gets the mapped type node's type parameter.
class MemberExpression
class MemberExpression< T extends ts.MemberExpression = ts.MemberExpression> extends LeftHandSideExpression<T> {}
class MemoryEmitResult
class MemoryEmitResult extends EmitResult {}
Result of an emit to memory.
method getFiles
getFiles: () => MemoryEmitResultFile[];
Gets the files that were emitted to memory.
method saveFiles
saveFiles: () => Promise<void[]>;
Asynchronously writes the files to the file system.
method saveFilesSync
saveFilesSync: () => void;
Synchronously writes the files to the file system.
Remarks
Use
saveFiles()
as the asynchronous version will be much faster.
class MetaProperty
class MetaProperty extends MetaPropertyBase<ts.MetaProperty> {}
method getKeywordToken
getKeywordToken: () => SyntaxKind.ImportKeyword | SyntaxKind.NewKeyword;
Gets the keyword token.
method getParent
getParent: () => NodeParentType<ts.MetaProperty>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.MetaProperty>>;
*
class MethodDeclaration
class MethodDeclaration extends MethodDeclarationBase<ts.MethodDeclaration> {}
method addOverload
addOverload: ( structure: OptionalKind<MethodDeclarationOverloadStructure>) => MethodDeclaration;
Add a method overload.
Parameter structure
Structure to add.
method addOverloads
addOverloads: ( structures: ReadonlyArray<OptionalKind<MethodDeclarationOverloadStructure>>) => MethodDeclaration[];
Add method overloads.
Parameter structures
Structures to add.
method getParent
getParent: () => NodeParentType<ts.MethodDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.MethodDeclaration>>;
*
method getStructure
getStructure: () => | MethodDeclarationStructure | MethodDeclarationOverloadStructure;
Gets the structure equivalent to this node.
method insertOverload
insertOverload: ( index: number, structure: OptionalKind<MethodDeclarationOverloadStructure>) => MethodDeclaration;
Inserts a method overload.
Parameter index
Child index to insert at.
Parameter structure
Structures to insert.
method insertOverloads
insertOverloads: ( index: number, structures: ReadonlyArray<OptionalKind<MethodDeclarationOverloadStructure>>) => MethodDeclaration[];
Inserts method overloads.
Parameter index
Child index to insert at.
Parameter structures
Structures to insert.
method set
set: (structure: Partial<MethodDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class MethodSignature
class MethodSignature extends MethodSignatureBase<ts.MethodSignature> {}
method getParent
getParent: () => NodeParentType<ts.MethodSignature>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.MethodSignature>>;
*
method getStructure
getStructure: () => MethodSignatureStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<MethodSignatureStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class ModuleBlock
class ModuleBlock extends ModuleBlockBase<ts.ModuleBlock> {}
method getParent
getParent: () => NodeParentType<ts.ModuleBlock>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ModuleBlock>>;
*
class ModuleDeclaration
class ModuleDeclaration extends ModuleDeclarationBase<ts.ModuleDeclaration> {}
method getDeclarationKind
getDeclarationKind: () => ModuleDeclarationKind;
Gets the namesapce declaration kind.
method getDeclarationKindKeyword
getDeclarationKindKeyword: () => Node<ts.Node> | undefined;
Gets the namespace or module keyword or returns undefined if it's global.
method getName
getName: () => string;
Gets the full name of the namespace.
method getNameNodes
getNameNodes: () => Identifier[] | StringLiteral;
Gets the name nodes or the string literal.
method getParent
getParent: () => NodeParentType<ts.ModuleDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ModuleDeclaration>>;
*
method getStructure
getStructure: () => ModuleDeclarationStructure;
Gets the structure equivalent to this node.
method hasModuleKeyword
hasModuleKeyword: () => boolean;
Gets if this namespace has a namespace keyword.
method hasNamespaceKeyword
hasNamespaceKeyword: () => boolean;
Gets if this namespace has a namespace keyword.
method rename
rename: (newName: string, options?: RenameOptions) => this;
Renames the module name.
Note: The TS compiler does not update module declarations for string literal module names unfortunately.
Parameter newName
New name.
Parameter options
Options for renaming.
method set
set: (structure: Partial<ModuleDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setDeclarationKind
setDeclarationKind: (kind: ModuleDeclarationKind) => this;
Sets the namespace declaration kind.
Parameter kind
Kind to set.
method setName
setName: (newName: string) => this;
Sets the name without renaming references.
Parameter newName
New full namespace name.
class NamedExports
class NamedExports extends NamedExportsBase<ts.NamedExports> {}
method getElements
getElements: () => ExportSpecifier[];
Gets the export specifiers.
method getParent
getParent: () => NodeParentType<ts.NamedExports>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NamedExports>>;
*
class NamedImports
class NamedImports extends NamedImportsBase<ts.NamedImports> {}
method getElements
getElements: () => ImportSpecifier[];
Gets the import specifiers.
method getParent
getParent: () => NodeParentType<ts.NamedImports>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NamedImports>>;
*
class NamedTupleMember
class NamedTupleMember extends NamedTupleMemberBase<ts.NamedTupleMember> {}
A named/labeled tuple element.
Ex.
start: number
intype Range = [start: number, end: number]
method getParent
getParent: () => NodeParentType<ts.NamedTupleMember>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NamedTupleMember>>;
*
method getTypeNode
getTypeNode: () => TypeNode<ts.TypeNode>;
Gets the named tuple type's type.
method removeType
removeType: () => never;
Throws. This is not supported for NamedTupleMember.
class NamespaceExport
class NamespaceExport extends NamespaceExportBase<ts.NamespaceExport> {}
method getName
getName: () => string;
Gets the name of the namespace export.
method getNameNode
getNameNode: () => StringLiteral | Identifier;
Gets the namespace export's name node.
method getParent
getParent: () => NodeParentType<ts.NamespaceExport>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NamespaceExport>>;
*
method setName
setName: (name: string) => this;
Sets the name of the namespace export.
class NamespaceImport
class NamespaceImport extends NamespaceImportBase<ts.NamespaceImport> {}
method getName
getName: () => string;
Gets the name of the namespace import.
method getNameNode
getNameNode: () => Identifier;
Gets the namespace import's name node.
method getParent
getParent: () => NodeParentType<ts.NamespaceImport>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NamespaceImport>>;
*
method setName
setName: (name: string) => this;
Sets the name of the namespace import.
class NewExpression
class NewExpression extends NewExpressionBase<ts.NewExpression> {}
method getParent
getParent: () => NodeParentType<ts.NewExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NewExpression>>;
*
class Node
class Node<NodeType extends ts.Node = ts.Node> {}
constructor
protected constructor();
property compilerNode
readonly compilerNode: ts.Node;
Gets the underlying compiler node.
property isAnyKeyword
static readonly isAnyKeyword: ( node: Node | undefined) => node is Expression<ts.Expression>;
Gets if the node is an AnyKeyword.
property isArrayBindingPattern
static readonly isArrayBindingPattern: ( node: Node | undefined) => node is ArrayBindingPattern;
Gets if the node is an ArrayBindingPattern.
property isArrayLiteralExpression
static readonly isArrayLiteralExpression: ( node: Node | undefined) => node is ArrayLiteralExpression;
Gets if the node is an ArrayLiteralExpression.
property isArrowFunction
static readonly isArrowFunction: ( node: Node | undefined) => node is ArrowFunction;
Gets if the node is an ArrowFunction.
property isAsExpression
static readonly isAsExpression: (node: Node | undefined) => node is AsExpression;
Gets if the node is an AsExpression.
property isAwaitExpression
static readonly isAwaitExpression: ( node: Node | undefined) => node is AwaitExpression;
Gets if the node is an AwaitExpression.
property isBigIntLiteral
static readonly isBigIntLiteral: ( node: Node | undefined) => node is BigIntLiteral;
Gets if the node is a BigIntLiteral.
property isBinaryExpression
static readonly isBinaryExpression: ( node: Node | undefined) => node is BinaryExpression<ts.BinaryExpression>;
Gets if the node is a BinaryExpression.
property isBindingElement
static readonly isBindingElement: ( node: Node | undefined) => node is BindingElement;
Gets if the node is a BindingElement.
property isBlock
static readonly isBlock: (node: Node | undefined) => node is Block;
Gets if the node is a Block.
property isBooleanKeyword
static readonly isBooleanKeyword: ( node: Node | undefined) => node is Expression<ts.Expression>;
Gets if the node is a BooleanKeyword.
property isBreakStatement
static readonly isBreakStatement: ( node: Node | undefined) => node is BreakStatement;
Gets if the node is a BreakStatement.
property isCallExpression
static readonly isCallExpression: ( node: Node | undefined) => node is CallExpression<ts.CallExpression>;
Gets if the node is a CallExpression.
property isCaseBlock
static readonly isCaseBlock: (node: Node | undefined) => node is CaseBlock;
Gets if the node is a CaseBlock.
property isCaseClause
static readonly isCaseClause: (node: Node | undefined) => node is CaseClause;
Gets if the node is a CaseClause.
property isCatchClause
static readonly isCatchClause: (node: Node | undefined) => node is CatchClause;
Gets if the node is a CatchClause.
property isClassDeclaration
static readonly isClassDeclaration: ( node: Node | undefined) => node is ClassDeclaration;
Gets if the node is a ClassDeclaration.
property isClassExpression
static readonly isClassExpression: ( node: Node | undefined) => node is ClassExpression;
Gets if the node is a ClassExpression.
property isClassStaticBlockDeclaration
static readonly isClassStaticBlockDeclaration: ( node: Node | undefined) => node is ClassStaticBlockDeclaration;
Gets if the node is a ClassStaticBlockDeclaration.
property isCommaListExpression
static readonly isCommaListExpression: ( node: Node | undefined) => node is CommaListExpression;
Gets if the node is a CommaListExpression.
property isComputedPropertyName
static readonly isComputedPropertyName: ( node: Node | undefined) => node is ComputedPropertyName;
Gets if the node is a ComputedPropertyName.
property isConditionalExpression
static readonly isConditionalExpression: ( node: Node | undefined) => node is ConditionalExpression;
Gets if the node is a ConditionalExpression.
property isContinueStatement
static readonly isContinueStatement: ( node: Node | undefined) => node is ContinueStatement;
Gets if the node is a ContinueStatement.
property isDebuggerStatement
static readonly isDebuggerStatement: ( node: Node | undefined) => node is DebuggerStatement;
Gets if the node is a DebuggerStatement.
property isDecorator
static readonly isDecorator: (node: Node | undefined) => node is Decorator;
Gets if the node is a Decorator.
property isDefaultClause
static readonly isDefaultClause: ( node: Node | undefined) => node is DefaultClause;
Gets if the node is a DefaultClause.
property isDeleteExpression
static readonly isDeleteExpression: ( node: Node | undefined) => node is DeleteExpression;
Gets if the node is a DeleteExpression.
property isDoStatement
static readonly isDoStatement: (node: Node | undefined) => node is DoStatement;
Gets if the node is a DoStatement.
property isElementAccessExpression
static readonly isElementAccessExpression: ( node: Node | undefined) => node is ElementAccessExpression<ts.ElementAccessExpression>;
Gets if the node is an ElementAccessExpression.
property isEmptyStatement
static readonly isEmptyStatement: ( node: Node | undefined) => node is EmptyStatement;
Gets if the node is an EmptyStatement.
property isEnumDeclaration
static readonly isEnumDeclaration: ( node: Node | undefined) => node is EnumDeclaration;
Gets if the node is an EnumDeclaration.
property isEnumMember
static readonly isEnumMember: (node: Node | undefined) => node is EnumMember;
Gets if the node is an EnumMember.
property isExportAssignment
static readonly isExportAssignment: ( node: Node | undefined) => node is ExportAssignment;
Gets if the node is an ExportAssignment.
property isExportDeclaration
static readonly isExportDeclaration: ( node: Node | undefined) => node is ExportDeclaration;
Gets if the node is an ExportDeclaration.
property isExportSpecifier
static readonly isExportSpecifier: ( node: Node | undefined) => node is ExportSpecifier;
Gets if the node is an ExportSpecifier.
property isExpressionStatement
static readonly isExpressionStatement: ( node: Node | undefined) => node is ExpressionStatement;
Gets if the node is an ExpressionStatement.
property isExpressionWithTypeArguments
static readonly isExpressionWithTypeArguments: ( node: Node | undefined) => node is ExpressionWithTypeArguments;
Gets if the node is an ExpressionWithTypeArguments.
property isExternalModuleReference
static readonly isExternalModuleReference: ( node: Node | undefined) => node is ExternalModuleReference;
Gets if the node is an ExternalModuleReference.
property isForInStatement
static readonly isForInStatement: ( node: Node | undefined) => node is ForInStatement;
Gets if the node is a ForInStatement.
property isForOfStatement
static readonly isForOfStatement: ( node: Node | undefined) => node is ForOfStatement;
Gets if the node is a ForOfStatement.
property isForStatement
static readonly isForStatement: (node: Node | undefined) => node is ForStatement;
Gets if the node is a ForStatement.
property isFunctionDeclaration
static readonly isFunctionDeclaration: ( node: Node | undefined) => node is FunctionDeclaration;
Gets if the node is a FunctionDeclaration.
property isFunctionExpression
static readonly isFunctionExpression: ( node: Node | undefined) => node is FunctionExpression;
Gets if the node is a FunctionExpression.
property isHeritageClause
static readonly isHeritageClause: ( node: Node | undefined) => node is HeritageClause;
Gets if the node is a HeritageClause.
property isIdentifier
static readonly isIdentifier: (node: Node | undefined) => node is Identifier;
Gets if the node is a Identifier.
property isIfStatement
static readonly isIfStatement: (node: Node | undefined) => node is IfStatement;
Gets if the node is a IfStatement.
property isImportAttribute
static readonly isImportAttribute: ( node: Node | undefined) => node is ImportAttribute;
Gets if the node is a ImportAttribute.
property isImportAttributes
static readonly isImportAttributes: ( node: Node | undefined) => node is ImportAttributes;
Gets if the node is a ImportAttributes.
property isImportClause
static readonly isImportClause: (node: Node | undefined) => node is ImportClause;
Gets if the node is a ImportClause.
property isImportDeclaration
static readonly isImportDeclaration: ( node: Node | undefined) => node is ImportDeclaration;
Gets if the node is a ImportDeclaration.
property isImportEqualsDeclaration
static readonly isImportEqualsDeclaration: ( node: Node | undefined) => node is ImportEqualsDeclaration;
Gets if the node is a ImportEqualsDeclaration.
property isImportSpecifier
static readonly isImportSpecifier: ( node: Node | undefined) => node is ImportSpecifier;
Gets if the node is a ImportSpecifier.
property isInferKeyword
static readonly isInferKeyword: ( node: Node | undefined) => node is Node<ts.Token<SyntaxKind.InferKeyword>>;
Gets if the node is a InferKeyword.
property isInterfaceDeclaration
static readonly isInterfaceDeclaration: ( node: Node | undefined) => node is InterfaceDeclaration;
Gets if the node is a InterfaceDeclaration.
property isJSDoc
static readonly isJSDoc: (node: Node | undefined) => node is JSDoc;
Gets if the node is a JSDoc.
property isJSDocAllType
static readonly isJSDocAllType: (node: Node | undefined) => node is JSDocAllType;
Gets if the node is a JSDocAllType.
property isJSDocAugmentsTag
static readonly isJSDocAugmentsTag: ( node: Node | undefined) => node is JSDocAugmentsTag;
Gets if the node is a JSDocAugmentsTag.
property isJSDocAuthorTag
static readonly isJSDocAuthorTag: ( node: Node | undefined) => node is JSDocAuthorTag;
Gets if the node is a JSDocAuthorTag.
property isJSDocCallbackTag
static readonly isJSDocCallbackTag: ( node: Node | undefined) => node is JSDocCallbackTag;
Gets if the node is a JSDocCallbackTag.
property isJSDocClassTag
static readonly isJSDocClassTag: ( node: Node | undefined) => node is JSDocClassTag;
Gets if the node is a JSDocClassTag.
property isJSDocDeprecatedTag
static readonly isJSDocDeprecatedTag: ( node: Node | undefined) => node is JSDocDeprecatedTag;
Gets if the node is a JSDocDeprecatedTag.
property isJSDocEnumTag
static readonly isJSDocEnumTag: (node: Node | undefined) => node is JSDocEnumTag;
Gets if the node is a JSDocEnumTag.
property isJSDocFunctionType
static readonly isJSDocFunctionType: ( node: Node | undefined) => node is JSDocFunctionType;
Gets if the node is a JSDocFunctionType.
property isJSDocImplementsTag
static readonly isJSDocImplementsTag: ( node: Node | undefined) => node is JSDocImplementsTag;
Gets if the node is a JSDocImplementsTag.
property isJSDocLink
static readonly isJSDocLink: (node: Node | undefined) => node is JSDocLink;
Gets if the node is a JSDocLink.
property isJSDocLinkCode
static readonly isJSDocLinkCode: ( node: Node | undefined) => node is JSDocLinkCode;
Gets if the node is a JSDocLinkCode.
property isJSDocLinkPlain
static readonly isJSDocLinkPlain: ( node: Node | undefined) => node is JSDocLinkPlain;
Gets if the node is a JSDocLinkPlain.
property isJSDocMemberName
static readonly isJSDocMemberName: ( node: Node | undefined) => node is JSDocMemberName;
Gets if the node is a JSDocMemberName.
property isJSDocNamepathType
static readonly isJSDocNamepathType: ( node: Node | undefined) => node is JSDocNamepathType;
Gets if the node is a JSDocNamepathType.
property isJSDocNameReference
static readonly isJSDocNameReference: ( node: Node | undefined) => node is JSDocNameReference;
Gets if the node is a JSDocNameReference.
property isJSDocNonNullableType
static readonly isJSDocNonNullableType: ( node: Node | undefined) => node is JSDocNonNullableType;
Gets if the node is a JSDocNonNullableType.
property isJSDocNullableType
static readonly isJSDocNullableType: ( node: Node | undefined) => node is JSDocNullableType;
Gets if the node is a JSDocNullableType.
property isJSDocOptionalType
static readonly isJSDocOptionalType: ( node: Node | undefined) => node is JSDocOptionalType;
Gets if the node is a JSDocOptionalType.
property isJSDocOverloadTag
static readonly isJSDocOverloadTag: ( node: Node | undefined) => node is JSDocOverloadTag;
Gets if the node is a JSDocOverloadTag.
property isJSDocOverrideTag
static readonly isJSDocOverrideTag: ( node: Node | undefined) => node is JSDocOverrideTag;
Gets if the node is a JSDocOverrideTag.
property isJSDocParameterTag
static readonly isJSDocParameterTag: ( node: Node | undefined) => node is JSDocParameterTag;
Gets if the node is a JSDocParameterTag.
property isJSDocPrivateTag
static readonly isJSDocPrivateTag: ( node: Node | undefined) => node is JSDocPrivateTag;
Gets if the node is a JSDocPrivateTag.
property isJSDocPropertyTag
static readonly isJSDocPropertyTag: ( node: Node | undefined) => node is JSDocPropertyTag;
Gets if the node is a JSDocPropertyTag.
property isJSDocProtectedTag
static readonly isJSDocProtectedTag: ( node: Node | undefined) => node is JSDocProtectedTag;
Gets if the node is a JSDocProtectedTag.
property isJSDocPublicTag
static readonly isJSDocPublicTag: ( node: Node | undefined) => node is JSDocPublicTag;
Gets if the node is a JSDocPublicTag.
property isJSDocReadonlyTag
static readonly isJSDocReadonlyTag: ( node: Node | undefined) => node is JSDocReadonlyTag;
Gets if the node is a JSDocReadonlyTag.
property isJSDocReturnTag
static readonly isJSDocReturnTag: ( node: Node | undefined) => node is JSDocReturnTag;
Gets if the node is a JSDocReturnTag.
property isJSDocSatisfiesTag
static readonly isJSDocSatisfiesTag: ( node: Node | undefined) => node is JSDocSatisfiesTag;
Gets if the node is a JSDocSatisfiesTag.
property isJSDocSeeTag
static readonly isJSDocSeeTag: (node: Node | undefined) => node is JSDocSeeTag;
Gets if the node is a JSDocSeeTag.
property isJSDocSignature
static readonly isJSDocSignature: ( node: Node | undefined) => node is JSDocSignature;
Gets if the node is a JSDocSignature.
property isJSDocTemplateTag
static readonly isJSDocTemplateTag: ( node: Node | undefined) => node is JSDocTemplateTag;
Gets if the node is a JSDocTemplateTag.
property isJSDocText
static readonly isJSDocText: (node: Node | undefined) => node is JSDocText;
Gets if the node is a JSDocText.
property isJSDocThisTag
static readonly isJSDocThisTag: (node: Node | undefined) => node is JSDocThisTag;
Gets if the node is a JSDocThisTag.
property isJSDocThrowsTag
static readonly isJSDocThrowsTag: ( node: Node | undefined) => node is JSDocThrowsTag;
Gets if the node is a JSDocThrowsTag.
property isJSDocTypedefTag
static readonly isJSDocTypedefTag: ( node: Node | undefined) => node is JSDocTypedefTag;
Gets if the node is a JSDocTypedefTag.
property isJSDocTypeExpression
static readonly isJSDocTypeExpression: ( node: Node | undefined) => node is JSDocTypeExpression;
Gets if the node is a JSDocTypeExpression.
property isJSDocTypeLiteral
static readonly isJSDocTypeLiteral: ( node: Node | undefined) => node is JSDocTypeLiteral;
Gets if the node is a JSDocTypeLiteral.
property isJSDocTypeTag
static readonly isJSDocTypeTag: (node: Node | undefined) => node is JSDocTypeTag;
Gets if the node is a JSDocTypeTag.
property isJSDocUnknownType
static readonly isJSDocUnknownType: ( node: Node | undefined) => node is JSDocUnknownType;
Gets if the node is a JSDocUnknownType.
property isJSDocVariadicType
static readonly isJSDocVariadicType: ( node: Node | undefined) => node is JSDocVariadicType;
Gets if the node is a JSDocVariadicType.
property isJsxAttribute
static readonly isJsxAttribute: (node: Node | undefined) => node is JsxAttribute;
Gets if the node is a JsxAttribute.
property isJsxClosingElement
static readonly isJsxClosingElement: ( node: Node | undefined) => node is JsxClosingElement;
Gets if the node is a JsxClosingElement.
property isJsxClosingFragment
static readonly isJsxClosingFragment: ( node: Node | undefined) => node is JsxClosingFragment;
Gets if the node is a JsxClosingFragment.
property isJsxElement
static readonly isJsxElement: (node: Node | undefined) => node is JsxElement;
Gets if the node is a JsxElement.
property isJsxExpression
static readonly isJsxExpression: ( node: Node | undefined) => node is JsxExpression;
Gets if the node is a JsxExpression.
property isJsxFragment
static readonly isJsxFragment: (node: Node | undefined) => node is JsxFragment;
Gets if the node is a JsxFragment.
property isJsxNamespacedName
static readonly isJsxNamespacedName: ( node: Node | undefined) => node is JsxNamespacedName;
Gets if the node is a JsxNamespacedName.
property isJsxOpeningElement
static readonly isJsxOpeningElement: ( node: Node | undefined) => node is JsxOpeningElement;
Gets if the node is a JsxOpeningElement.
property isJsxOpeningFragment
static readonly isJsxOpeningFragment: ( node: Node | undefined) => node is JsxOpeningFragment;
Gets if the node is a JsxOpeningFragment.
property isJsxSelfClosingElement
static readonly isJsxSelfClosingElement: ( node: Node | undefined) => node is JsxSelfClosingElement;
Gets if the node is a JsxSelfClosingElement.
property isJsxSpreadAttribute
static readonly isJsxSpreadAttribute: ( node: Node | undefined) => node is JsxSpreadAttribute;
Gets if the node is a JsxSpreadAttribute.
property isJsxText
static readonly isJsxText: (node: Node | undefined) => node is JsxText;
Gets if the node is a JsxText.
property isLabeledStatement
static readonly isLabeledStatement: ( node: Node | undefined) => node is LabeledStatement;
Gets if the node is a LabeledStatement.
property isMetaProperty
static readonly isMetaProperty: (node: Node | undefined) => node is MetaProperty;
Gets if the node is a MetaProperty.
property isMethodDeclaration
static readonly isMethodDeclaration: ( node: Node | undefined) => node is MethodDeclaration;
Gets if the node is a MethodDeclaration.
property isMethodSignature
static readonly isMethodSignature: ( node: Node | undefined) => node is MethodSignature;
Gets if the node is a MethodSignature.
property isModuleBlock
static readonly isModuleBlock: (node: Node | undefined) => node is ModuleBlock;
Gets if the node is a ModuleBlock.
property isModuleDeclaration
static readonly isModuleDeclaration: ( node: Node | undefined) => node is ModuleDeclaration;
Gets if the node is a ModuleDeclaration.
property isNamedExports
static readonly isNamedExports: (node: Node | undefined) => node is NamedExports;
Gets if the node is a NamedExports.
property isNamedImports
static readonly isNamedImports: (node: Node | undefined) => node is NamedImports;
Gets if the node is a NamedImports.
property isNamedTupleMember
static readonly isNamedTupleMember: ( node: Node | undefined) => node is NamedTupleMember;
Gets if the node is a NamedTupleMember.
property isNamespaceExport
static readonly isNamespaceExport: ( node: Node | undefined) => node is NamespaceExport;
Gets if the node is a NamespaceExport.
property isNamespaceImport
static readonly isNamespaceImport: ( node: Node | undefined) => node is NamespaceImport;
Gets if the node is a NamespaceImport.
property isNeverKeyword
static readonly isNeverKeyword: ( node: Node | undefined) => node is Node<ts.Token<SyntaxKind.NeverKeyword>>;
Gets if the node is a NeverKeyword.
property isNewExpression
static readonly isNewExpression: ( node: Node | undefined) => node is NewExpression;
Gets if the node is a NewExpression.
property isNonNullExpression
static readonly isNonNullExpression: ( node: Node | undefined) => node is NonNullExpression;
Gets if the node is a NonNullExpression.
property isNoSubstitutionTemplateLiteral
static readonly isNoSubstitutionTemplateLiteral: ( node: Node | undefined) => node is NoSubstitutionTemplateLiteral;
Gets if the node is a NoSubstitutionTemplateLiteral.
property isNotEmittedStatement
static readonly isNotEmittedStatement: ( node: Node | undefined) => node is NotEmittedStatement;
Gets if the node is a NotEmittedStatement.
property isNumberKeyword
static readonly isNumberKeyword: ( node: Node | undefined) => node is Expression<ts.Expression>;
Gets if the node is a NumberKeyword.
property isNumericLiteral
static readonly isNumericLiteral: ( node: Node | undefined) => node is NumericLiteral;
Gets if the node is a NumericLiteral.
property isObjectBindingPattern
static readonly isObjectBindingPattern: ( node: Node | undefined) => node is ObjectBindingPattern;
Gets if the node is a ObjectBindingPattern.
property isObjectKeyword
static readonly isObjectKeyword: ( node: Node | undefined) => node is Expression<ts.Expression>;
Gets if the node is a ObjectKeyword.
property isObjectLiteralExpression
static readonly isObjectLiteralExpression: ( node: Node | undefined) => node is ObjectLiteralExpression;
Gets if the node is a ObjectLiteralExpression.
property isOmittedExpression
static readonly isOmittedExpression: ( node: Node | undefined) => node is OmittedExpression;
Gets if the node is a OmittedExpression.
property isParenthesizedExpression
static readonly isParenthesizedExpression: ( node: Node | undefined) => node is ParenthesizedExpression;
Gets if the node is a ParenthesizedExpression.
property isPartiallyEmittedExpression
static readonly isPartiallyEmittedExpression: ( node: Node | undefined) => node is PartiallyEmittedExpression;
Gets if the node is a PartiallyEmittedExpression.
property isPostfixUnaryExpression
static readonly isPostfixUnaryExpression: ( node: Node | undefined) => node is PostfixUnaryExpression;
Gets if the node is a PostfixUnaryExpression.
property isPrefixUnaryExpression
static readonly isPrefixUnaryExpression: ( node: Node | undefined) => node is PrefixUnaryExpression;
Gets if the node is a PrefixUnaryExpression.
property isPrivateIdentifier
static readonly isPrivateIdentifier: ( node: Node | undefined) => node is PrivateIdentifier;
Gets if the node is a PrivateIdentifier.
property isPropertyAccessExpression
static readonly isPropertyAccessExpression: ( node: Node | undefined) => node is PropertyAccessExpression<ts.PropertyAccessExpression>;
Gets if the node is a PropertyAccessExpression.
property isPropertyAssignment
static readonly isPropertyAssignment: ( node: Node | undefined) => node is PropertyAssignment;
Gets if the node is a PropertyAssignment.
property isPropertyDeclaration
static readonly isPropertyDeclaration: ( node: Node | undefined) => node is PropertyDeclaration;
Gets if the node is a PropertyDeclaration.
property isPropertySignature
static readonly isPropertySignature: ( node: Node | undefined) => node is PropertySignature;
Gets if the node is a PropertySignature.
property isQualifiedName
static readonly isQualifiedName: ( node: Node | undefined) => node is QualifiedName;
Gets if the node is a QualifiedName.
property isRegularExpressionLiteral
static readonly isRegularExpressionLiteral: ( node: Node | undefined) => node is RegularExpressionLiteral;
Gets if the node is a RegularExpressionLiteral.
property isReturnStatement
static readonly isReturnStatement: ( node: Node | undefined) => node is ReturnStatement;
Gets if the node is a ReturnStatement.
property isSatisfiesExpression
static readonly isSatisfiesExpression: ( node: Node | undefined) => node is SatisfiesExpression;
Gets if the node is a SatisfiesExpression.
property isSemicolonToken
static readonly isSemicolonToken: ( node: Node | undefined) => node is Node<ts.Token<SyntaxKind.SemicolonToken>>;
Gets if the node is a SemicolonToken.
property isShorthandPropertyAssignment
static readonly isShorthandPropertyAssignment: ( node: Node | undefined) => node is ShorthandPropertyAssignment;
Gets if the node is a ShorthandPropertyAssignment.
property isSourceFile
static readonly isSourceFile: (node: Node | undefined) => node is SourceFile;
Gets if the node is a SourceFile.
property isSpreadAssignment
static readonly isSpreadAssignment: ( node: Node | undefined) => node is SpreadAssignment;
Gets if the node is a SpreadAssignment.
property isSpreadElement
static readonly isSpreadElement: ( node: Node | undefined) => node is SpreadElement;
Gets if the node is a SpreadElement.
property isStringKeyword
static readonly isStringKeyword: ( node: Node | undefined) => node is Expression<ts.Expression>;
Gets if the node is a StringKeyword.
property isStringLiteral
static readonly isStringLiteral: ( node: Node | undefined) => node is StringLiteral;
Gets if the node is a StringLiteral.
property isSwitchStatement
static readonly isSwitchStatement: ( node: Node | undefined) => node is SwitchStatement;
Gets if the node is a SwitchStatement.
property isSymbolKeyword
static readonly isSymbolKeyword: ( node: Node | undefined) => node is Expression<ts.Expression>;
Gets if the node is a SymbolKeyword.
property isSyntaxList
static readonly isSyntaxList: (node: Node | undefined) => node is SyntaxList;
Gets if the node is a SyntaxList.
property isTaggedTemplateExpression
static readonly isTaggedTemplateExpression: ( node: Node | undefined) => node is TaggedTemplateExpression;
Gets if the node is a TaggedTemplateExpression.
property isTemplateExpression
static readonly isTemplateExpression: ( node: Node | undefined) => node is TemplateExpression;
Gets if the node is a TemplateExpression.
property isTemplateHead
static readonly isTemplateHead: (node: Node | undefined) => node is TemplateHead;
Gets if the node is a TemplateHead.
property isTemplateMiddle
static readonly isTemplateMiddle: ( node: Node | undefined) => node is TemplateMiddle;
Gets if the node is a TemplateMiddle.
property isTemplateSpan
static readonly isTemplateSpan: (node: Node | undefined) => node is TemplateSpan;
Gets if the node is a TemplateSpan.
property isTemplateTail
static readonly isTemplateTail: (node: Node | undefined) => node is TemplateTail;
Gets if the node is a TemplateTail.
property isThrowStatement
static readonly isThrowStatement: ( node: Node | undefined) => node is ThrowStatement;
Gets if the node is a ThrowStatement.
property isTryStatement
static readonly isTryStatement: (node: Node | undefined) => node is TryStatement;
Gets if the node is a TryStatement.
property isTypeAliasDeclaration
static readonly isTypeAliasDeclaration: ( node: Node | undefined) => node is TypeAliasDeclaration;
Gets if the node is a TypeAliasDeclaration.
property isTypeOfExpression
static readonly isTypeOfExpression: ( node: Node | undefined) => node is TypeOfExpression;
Gets if the node is a TypeOfExpression.
property isUndefinedKeyword
static readonly isUndefinedKeyword: ( node: Node | undefined) => node is Expression<ts.Expression>;
Gets if the node is a UndefinedKeyword.
property isVariableDeclaration
static readonly isVariableDeclaration: ( node: Node | undefined) => node is VariableDeclaration;
Gets if the node is a VariableDeclaration.
property isVariableDeclarationList
static readonly isVariableDeclarationList: ( node: Node | undefined) => node is VariableDeclarationList;
Gets if the node is a VariableDeclarationList.
property isVariableStatement
static readonly isVariableStatement: ( node: Node | undefined) => node is VariableStatement;
Gets if the node is a VariableStatement.
property isVoidExpression
static readonly isVoidExpression: ( node: Node | undefined) => node is VoidExpression;
Gets if the node is a VoidExpression.
property isWhileStatement
static readonly isWhileStatement: ( node: Node | undefined) => node is WhileStatement;
Gets if the node is a WhileStatement.
property isWithStatement
static readonly isWithStatement: ( node: Node | undefined) => node is WithStatement;
Gets if the node is a WithStatement.
property isYieldExpression
static readonly isYieldExpression: ( node: Node | undefined) => node is YieldExpression;
Gets if the node is a YieldExpression.
method appendWhitespace
appendWhitespace: (textOrWriterFunction: string | WriterFunction) => void;
Appends the specified whitespace to current node.
Parameter textOrWriterFunction
Text or writer function.
method asKind
asKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the node as the specified kind if it is equal to that kind, otherwise returns undefined.
Parameter kind
Syntax kind.
method asKindOrThrow
asKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the node as the specified kind if it is equal to that kind, otherwise throws.
Parameter kind
Syntax kind.
method containsRange
containsRange: (pos: number, end: number) => boolean;
If the node contains the provided range (inclusive).
Parameter pos
Start position.
Parameter end
End position.
method forEachChild
forEachChild: <T>( cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: Node[]) => T | undefined) => T | undefined;
Invokes the
cbNode
callback for each child and thecbNodeArray
for every array of nodes stored in properties of the node. IfcbNodeArray
is not defined, then it will pass every element of the array tocbNode
.Parameter cbNode
Callback invoked for each child.
Parameter cbNodeArray
Callback invoked for each array of nodes.
Returns
The first truthy value returned by a callback.
method forEachChildAsArray
forEachChildAsArray: () => Node<ts.Node>[];
Gets the child nodes passed to the delegate of
node.forEachChild(child => {})
as an array.
method forEachDescendant
forEachDescendant: <T>( cbNode: ( node: Node, traversal: ForEachDescendantTraversalControl ) => T | undefined, cbNodeArray?: ( nodes: Node[], traversal: ForEachDescendantTraversalControl ) => T | undefined) => T | undefined;
Invokes the
cbNode
callback for each descendant and thecbNodeArray
for every array of nodes stored in properties of the node and descendant nodes. IfcbNodeArray
is not defined, then it will pass every element of the array tocbNode
.Parameter cbNode
Callback invoked for each descendant.
Parameter cbNodeArray
Callback invoked for each array of nodes.
Returns
The first truthy value returned by a callback.
Remarks
There exists a
traversal
object on the second parameter that allows various control of iteration.
method forEachDescendantAsArray
forEachDescendantAsArray: () => Node<ts.Node>[];
Gets the descendant nodes passed to the delegate of
node.forEachDescendant(descendant => {})
as an array.
method forget
forget: () => void;
Releases the node and all its descendants from the underlying node cache and ast.
This is useful if you want to improve the performance of manipulation by not tracking this node anymore.
method forgetDescendants
forgetDescendants: () => void;
Forgets the descendants of this node.
method formatText
formatText: (settings?: FormatCodeSettings) => void;
Formats the node's text using the internal TypeScript formatting API.
Parameter settings
Format code settings.
method getAncestors
getAncestors: () => Node[];
Goes up the tree getting all the parents in ascending order.
method getChildAtIndex
getChildAtIndex: (index: number) => Node;
Gets the child at the specified index.
Parameter index
Index of the child.
method getChildAtIndexIfKind
getChildAtIndexIfKind: <TKind extends SyntaxKind>( index: number, kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the child at the specified index if it's the specified kind or returns undefined.
Parameter index
Child index to get.
Parameter kind
Expected kind.
method getChildAtIndexIfKindOrThrow
getChildAtIndexIfKindOrThrow: <TKind extends SyntaxKind>( index: number, kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the child at the specified index if it's the specified kind or throws an exception.
Parameter index
Child index to get.
Parameter kind
Expected kind.
method getChildAtPos
getChildAtPos: (pos: number) => Node | undefined;
Gets the child at the provided text position, or undefined if not found.
Parameter pos
Text position to search for.
method getChildCount
getChildCount: () => number;
Gets the number of children the node has.
method getChildIndentationLevel
getChildIndentationLevel: () => number;
Gets the child indentation level of the current node.
method getChildIndentationText
getChildIndentationText: (offset?: number) => string;
Gets the next indentation level text.
Parameter offset
Optional number of levels of indentation to add or remove.
method getChildIndex
getChildIndex: () => number;
Gets the child index of this node relative to the parent.
method getChildren
getChildren: () => Node[];
Gets all the children of the node.
method getChildrenOfKind
getChildrenOfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind][];
Gets the children based on a kind.
Parameter kind
Syntax kind.
method getChildSyntaxList
getChildSyntaxList: () => SyntaxList | undefined;
Gets the child syntax list if it exists.
method getChildSyntaxListOrThrow
getChildSyntaxListOrThrow: (message?: string | (() => string)) => SyntaxList;
Gets the child syntax list or throws if it doesn't exist.
method getCombinedModifierFlags
getCombinedModifierFlags: () => ts.ModifierFlags;
Gets the combined modifier flags.
method getDescendantAtPos
getDescendantAtPos: (pos: number) => Node | undefined;
Gets the most specific descendant at the provided text position, or undefined if not found.
Parameter pos
Text position to search for.
method getDescendantAtStartWithWidth
getDescendantAtStartWithWidth: ( start: number, width: number) => Node | undefined;
Gets the most specific descendant at the provided start text position with the specified width, or undefined if not found.
Parameter start
Start text position to search for.
Parameter width
Text length of the node to search for.
method getDescendants
getDescendants: () => Node[];
Gets the node's descendants.
method getDescendantsOfKind
getDescendantsOfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind][];
Gets the descendants that match a specified syntax kind.
Parameter kind
Kind to check.
method getDescendantStatements
getDescendantStatements: () => (Statement | Expression)[];
Gets the node's descendant statements and any arrow function statement-like expressions (ex. returns the expression
5
in() => 5
).
method getEnd
getEnd: () => number;
Gets the source file text position where the node ends.
Remarks
This does not include the following trivia (comments and whitespace).
method getEndLineNumber
getEndLineNumber: () => number;
Gets the line number of the end of the node.
method getFirstAncestor
getFirstAncestor: { <T extends Node<ts.Node>>(condition?: (node: Node) => node is T): | T | undefined; (condition?: (node: Node<ts.Node>) => boolean): Node<ts.Node>;};
Gets the first ancestor that matches the provided condition or returns undefined if not found.
Parameter condition
Condition to match.
method getFirstAncestorByKind
getFirstAncestorByKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Get the first ancestor by syntax kind.
Parameter kind
Syntax kind.
method getFirstAncestorByKindOrThrow
getFirstAncestorByKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the first ancestor by syntax kind or throws if not found.
Parameter kind
Syntax kind.
method getFirstAncestorOrThrow
getFirstAncestorOrThrow: { <T extends Node<ts.Node>>(condition?: (node: Node) => node is T): T; (condition?: (node: Node<ts.Node>) => boolean): Node<ts.Node>;};
Gets the first ancestor that matches the provided condition or throws if not found.
Parameter condition
Condition to match.
method getFirstChild
getFirstChild: { <T extends Node<ts.Node>>(condition?: (node: Node) => node is T): | T | undefined; (condition?: (node: Node<ts.Node>) => boolean): Node<ts.Node>;};
Gets the first child by a condition.
Parameter condition
Condition.
method getFirstChildByKind
getFirstChildByKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the first child by syntax kind.
Parameter kind
Syntax kind.
method getFirstChildByKindOrThrow
getFirstChildByKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the first child by syntax kind or throws an error if not found.
Parameter kind
Syntax kind.
method getFirstChildIfKind
getFirstChildIfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the first child if it matches the specified syntax kind.
Parameter kind
Syntax kind.
method getFirstChildIfKindOrThrow
getFirstChildIfKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the first child if it matches the specified syntax kind or throws an error if not found.
Parameter kind
Syntax kind.
method getFirstChildOrThrow
getFirstChildOrThrow: { <T extends Node<ts.Node>>( condition?: (node: Node) => node is T, message?: string | (() => string) ): T; ( condition?: (node: Node<ts.Node>) => boolean, message?: string | (() => string) ): Node<ts.Node>;};
Gets the first child by a condition or throws.
Parameter condition
Condition.
method getFirstDescendant
getFirstDescendant: { <T extends Node<ts.Node>>(condition?: (node: Node) => node is T): | T | undefined; (condition?: (node: Node<ts.Node>) => boolean): Node<ts.Node>;};
Gets the first descendant by a condition.
Parameter condition
Condition.
method getFirstDescendantByKind
getFirstDescendantByKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the first descendant by syntax kind.
Parameter kind
Syntax kind.
method getFirstDescendantByKindOrThrow
getFirstDescendantByKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the first descendant by syntax kind or throws.
Parameter kind
Syntax kind.
method getFirstDescendantOrThrow
getFirstDescendantOrThrow: { <T extends Node<ts.Node>>( condition?: (node: Node) => node is T, message?: string | (() => string) ): T; ( condition?: (node: Node<ts.Node>) => boolean, message?: string | (() => string) ): Node<ts.Node>;};
Gets the first descendant by a condition or throws.
Parameter condition
Condition.
method getFlags
getFlags: () => ts.NodeFlags;
Gets the node's flags.
method getFullStart
getFullStart: () => number;
Gets the source file text position of the end of the last significant token or the start of the source file.
method getFullText
getFullText: () => string;
Gets the full text with leading trivia (comments and whitespace).
method getFullWidth
getFullWidth: () => number;
Gets the text length of the node with trivia.
method getIndentationLevel
getIndentationLevel: () => number;
Gets the indentation level of the current node.
method getIndentationText
getIndentationText: (offset?: number) => string;
Gets the indentation text.
Parameter offset
Optional number of levels of indentation to add or remove.
method getKind
getKind: () => SyntaxKind;
Gets the syntax kind.
method getKindName
getKindName: () => string;
Gets the syntax kind name.
method getLastChild
getLastChild: { <T extends Node<ts.Node>>(condition?: (node: Node) => node is T): | T | undefined; (condition?: (node: Node<ts.Node>) => boolean): Node<ts.Node>;};
Gets the last child by a condition.
Parameter condition
Condition.
method getLastChildByKind
getLastChildByKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the last child by syntax kind.
Parameter kind
Syntax kind.
method getLastChildByKindOrThrow
getLastChildByKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the last child by syntax kind or throws an error if not found.
Parameter kind
Syntax kind.
method getLastChildIfKind
getLastChildIfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the last child if it matches the specified syntax kind.
Parameter kind
Syntax kind.
method getLastChildIfKindOrThrow
getLastChildIfKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the last child if it matches the specified syntax kind or throws an error if not found.
Parameter kind
Syntax kind.
method getLastChildOrThrow
getLastChildOrThrow: { <T extends Node<ts.Node>>( condition?: (node: Node) => node is T, message?: string | (() => string) ): T; ( condition?: (node: Node<ts.Node>) => boolean, message?: string | (() => string) ): Node<ts.Node>;};
Gets the last child by a condition or throws.
Parameter condition
Condition.
method getLastToken
getLastToken: () => Node;
Gets the last token of this node. Usually this is a close brace.
method getLeadingCommentRanges
getLeadingCommentRanges: () => CommentRange[];
Gets the leading comment ranges of the current node.
method getLeadingTriviaWidth
getLeadingTriviaWidth: () => number;
Gets the node's leading trivia's text length.
method getLocal
getLocal: (name: string) => Symbol | undefined;
Gets the specified local symbol by name or returns undefined if it doesn't exist.
WARNING: The symbol table of locals is not exposed publicly by the compiler. Use this at your own risk knowing it may break.
Parameter name
Name of the local symbol.
method getLocalOrThrow
getLocalOrThrow: (name: string, message?: string | (() => string)) => Symbol;
Gets the specified local symbol by name or throws if it doesn't exist.
WARNING: The symbol table of locals is not exposed publicly by the compiler. Use this at your own risk knowing it may break.
Parameter name
Name of the local symbol.
method getLocals
getLocals: () => Symbol[];
Gets the symbols within the current scope.
WARNING: The symbol table of locals is not exposed publicly by the compiler. Use this at your own risk knowing it may break.
method getNextSibling
getNextSibling: { <T extends Node<ts.Node>>(condition?: (node: Node) => node is T): | T | undefined; (condition?: (node: Node<ts.Node>) => boolean): Node<ts.Node>;};
Gets the next sibling.
Parameter condition
Optional condition for getting the next sibling.
method getNextSiblingIfKind
getNextSiblingIfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the next sibling if it matches the specified kind.
Parameter kind
Kind to check.
method getNextSiblingIfKindOrThrow
getNextSiblingIfKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the next sibiling if it matches the specified kind, or throws.
Parameter kind
Kind to check.
method getNextSiblingOrThrow
getNextSiblingOrThrow: { <T extends Node<ts.Node>>( condition?: (node: Node) => node is T, message?: string | (() => string) ): T; ( condition?: (node: Node<ts.Node>) => boolean, message?: string | (() => string) ): Node<ts.Node>;};
Gets the next sibling or throws.
Parameter condition
Optional condition for getting the next sibling.
method getNextSiblings
getNextSiblings: () => Node[];
Gets the next siblings.
Note: Closest sibling is the zero index.
method getNodeProperty
getNodeProperty: < KeyType extends keyof LocalNodeType, LocalNodeType extends ts.Node = NodeType>( propertyName: KeyType) => NodePropertyToWrappedType<LocalNodeType, KeyType>;
Gets a compiler node property wrapped in a Node.
Parameter propertyName
Property name.
method getNonWhitespaceStart
getNonWhitespaceStart: () => number;
Gets the first source file text position that is not whitespace taking into account comment nodes and a previous node's trailing trivia.
method getParent
getParent: () => Node<ts.Node> | undefined;
Get the node's parent.
method getParentIf
getParentIf: { <T extends Node<ts.Node>>( condition: (parent: Node | undefined, node: Node) => parent is T ): T | undefined; ( condition: (parent: Node<ts.Node>, node: Node<ts.Node>) => boolean ): Node<ts.Node>;};
Gets the parent if it matches a certain condition.
method getParentIfKind
getParentIfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the parent if it's a certain syntax kind.
method getParentIfKindOrThrow
getParentIfKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the parent if it's a certain syntax kind or throws.
method getParentIfOrThrow
getParentIfOrThrow: { <T extends Node<ts.Node>>( condition: (parent: Node | undefined, node: Node) => parent is T, message?: string | (() => string) ): T; ( condition: (parent: Node<ts.Node>, node: Node<ts.Node>) => boolean, message?: string | (() => string) ): Node<ts.Node>;};
Gets the parent if it matches a certain condition or throws.
method getParentOrThrow
getParentOrThrow: (message?: string | (() => string)) => Node<ts.Node>;
Gets the parent or throws an error if it doesn't exist.
method getParentSyntaxList
getParentSyntaxList: () => SyntaxList | undefined;
Gets the parent if it's a syntax list.
method getParentSyntaxListOrThrow
getParentSyntaxListOrThrow: (message?: string | (() => string)) => SyntaxList;
Gets the parent if it's a syntax list or throws an error otherwise.
method getParentWhile
getParentWhile: { <T extends Node<ts.Node>>( condition: (parent: Node, child: Node) => parent is T ): T | undefined; ( condition: (parent: Node<ts.Node>, child: Node<ts.Node>) => boolean ): Node<ts.Node>;};
Goes up the parents (ancestors) of the node while a condition is true. Returns undefined if the initial parent doesn't match the condition.
Parameter condition
Condition that tests the parent to see if the expression is true.
method getParentWhileKind
getParentWhileKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Goes up the parents (ancestors) of the node while the parent is the specified syntax kind. Returns undefined if the initial parent is not the specified syntax kind.
Parameter kind
Syntax kind to check for.
method getParentWhileKindOrThrow
getParentWhileKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Goes up the parents (ancestors) of the node while the parent is the specified syntax kind. Throws if the initial parent is not the specified syntax kind.
Parameter kind
Syntax kind to check for.
method getParentWhileOrThrow
getParentWhileOrThrow: { <T extends Node<ts.Node>>( condition: (parent: Node, node: Node) => parent is T, message?: string | (() => string) ): T; ( condition: (parent: Node<ts.Node>, node: Node<ts.Node>) => boolean, message?: string | (() => string) ): Node<ts.Node>;};
Goes up the parents (ancestors) of the node while a condition is true. Throws if the initial parent doesn't match the condition.
Parameter condition
Condition that tests the parent to see if the expression is true.
method getPos
getPos: () => number;
Gets the source file text position where the node starts that includes the leading trivia (comments and whitespace).
method getPreviousSibling
getPreviousSibling: { <T extends Node<ts.Node>>(condition?: (node: Node) => node is T): | T | undefined; (condition?: (node: Node<ts.Node>) => boolean): Node<ts.Node>;};
Gets the previous sibling.
Parameter condition
Optional condition for getting the previous sibling.
method getPreviousSiblingIfKind
getPreviousSiblingIfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the previous sibling if it matches the specified kind.
Parameter kind
Kind to check.
method getPreviousSiblingIfKindOrThrow
getPreviousSiblingIfKindOrThrow: <TKind extends SyntaxKind>( kind: TKind, message?: string | (() => string)) => KindToNodeMappings[TKind];
Gets the previous sibiling if it matches the specified kind, or throws.
Parameter kind
Kind to check.
method getPreviousSiblingOrThrow
getPreviousSiblingOrThrow: { <T extends Node<ts.Node>>( condition?: (node: Node) => node is T, message?: string | (() => string) ): T; ( condition?: (node: Node<ts.Node>) => boolean, message?: string | (() => string) ): Node<ts.Node>;};
Gets the previous sibling or throws.
Parameter condition
Optional condition for getting the previous sibling.
method getPreviousSiblings
getPreviousSiblings: () => Node[];
Gets the previous siblings.
Note: Closest sibling is the zero index.
method getProject
getProject: () => Project;
Gets the project.
method getSourceFile
getSourceFile: () => SourceFile;
Gets the source file.
method getStart
getStart: (includeJsDocComments?: boolean) => number;
Gets the source file text position where the node starts that does not include the leading trivia (comments and whitespace).
Parameter includeJsDocComments
Whether to include the JS doc comments.
method getStartLineNumber
getStartLineNumber: (includeJsDocComments?: boolean) => number;
Gets the line number at the start of the node.
Parameter includeJsDocComments
Whether to include the JS doc comments or not.
method getStartLinePos
getStartLinePos: (includeJsDocComments?: boolean) => number;
Gets the position of the start of the line that this node starts on.
Parameter includeJsDocComments
Whether to include the JS doc comments or not.
method getSymbol
getSymbol: () => Symbol | undefined;
Gets the compiler symbol or undefined if it doesn't exist.
method getSymbolOrThrow
getSymbolOrThrow: (message?: string | (() => string)) => Symbol;
Gets the symbol or throws an error if it doesn't exist.
method getSymbolsInScope
getSymbolsInScope: (meaning: SymbolFlags) => Symbol[];
Gets the symbols in the scope of the node.
Note: This will always return the local symbols. If you want the export symbol from a local symbol, then use the
#getExportSymbol()
method on the symbol.Parameter meaning
Meaning of symbol to filter by.
method getText
getText: { (includeJsDocComments?: boolean): string; (options: { trimLeadingIndentation?: boolean; includeJsDocComments?: boolean; }): string;};
Gets the text without leading trivia (comments and whitespace).
Parameter includeJsDocComments
Whether to include the js doc comments when getting the text.
Gets the text without leading trivia (comments and whitespace).
Parameter options
Options for getting the text.
method getTrailingCommentRanges
getTrailingCommentRanges: () => CommentRange[];
Gets the trailing comment ranges of the current node.
method getTrailingTriviaEnd
getTrailingTriviaEnd: () => number;
Gets the text position of the next significant token or new line.
method getTrailingTriviaWidth
getTrailingTriviaWidth: () => number;
Gets the text length from the end of the current node to the next significant token or new line.
method getType
getType: () => Type;
Gets the type of the node.
method getWidth
getWidth: (includeJsDocComments?: boolean) => number;
Gets the text length of the node without trivia.
Parameter includeJsDocComments
Whether to include the JS doc comments in the width or not.
method hasBody
static hasBody: <T extends Node<ts.Node>>( node: T) => node is T & { getBody(): Node };
Gets if the node has a body.
Parameter node
Node to check.
method hasExpression
static hasExpression: <T extends Node<ts.Node>>( node: T) => node is T & { getExpression(): Expression };
Gets if the node has an expression.
Parameter node
Node to check.
method hasName
static hasName: <T extends Node<ts.Node>>( node: T) => node is T & { getName(): string; getNameNode(): Node };
Gets if the node has a name.
Parameter node
Node to check.
method hasStructure
static hasStructure: <T extends Node<ts.Node>>( node: T) => node is T & { getStructure(): Structures };
Gets if the node has a structure.
Parameter node
Node to check.
method is
static is: <TKind extends number>( kind: TKind) => (node: Node | undefined) => node is KindToNodeMappings[TKind];
Creates a type guard for syntax kinds.
method isAbstractable
static isAbstractable: <T extends Node<ts.Node>>( node: T | undefined) => node is AbstractableNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is an AbstractableNode.
method isAmbientable
static isAmbientable: <T extends Node<ts.Node>>( node: T | undefined) => node is AmbientableNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is an AmbientableNode.
method isArgumented
static isArgumented: <T extends Node<ts.Node>>( node: T | undefined) => node is ArgumentedNode & ArgumentedNodeExtensionType & T;
Gets if the node is an ArgumentedNode.
method isArrayTypeNode
static isArrayTypeNode: (node: Node | undefined) => node is ArrayTypeNode;
Gets if the node is an ArrayTypeNode.
method isAsyncable
static isAsyncable: <T extends Node<ts.Node>>( node: T | undefined) => node is AsyncableNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is an AsyncableNode.
method isAwaitable
static isAwaitable: <T extends Node<ts.Node>>( node: T | undefined) => node is AwaitableNode & AwaitableNodeExtensionType & T;
Gets if the node is an AwaitableNode.
method isBindingNamed
static isBindingNamed: <T extends Node<ts.Node>>( node: T | undefined) => node is BindingNamedNode & BindingNamedNodeExtensionType & T;
Gets if the node is a BindingNamedNode.
method isBodied
static isBodied: <T extends Node<ts.Node>>( node: T | undefined) => node is BodiedNode & BodiedNodeExtensionType & T;
Gets if the node is a BodiedNode.
method isBodyable
static isBodyable: <T extends Node<ts.Node>>( node: T | undefined) => node is BodyableNode & BodyableNodeExtensionType & T;
Gets if the node is a BodyableNode.
method isCallSignatureDeclaration
static isCallSignatureDeclaration: ( node: Node | undefined) => node is CallSignatureDeclaration;
Gets if the node is a CallSignatureDeclaration.
method isChildOrderable
static isChildOrderable: <T extends Node<ts.Node>>( node: T | undefined) => node is ChildOrderableNode & ChildOrderableNodeExtensionType & T;
Gets if the node is a ChildOrderableNode.
method isClassLikeDeclarationBase
static isClassLikeDeclarationBase: <T extends Node<ts.Node>>( node: T | undefined) => node is ClassLikeDeclarationBase & ClassLikeDeclarationBaseExtensionType & T;
Gets if the node is a ClassLikeDeclarationBase.
method isCommentClassElement
static isCommentClassElement: ( node: Node | undefined) => node is CommentClassElement;
Gets if the provided node is a CommentClassElement.
method isCommentEnumMember
static isCommentEnumMember: ( node: Node | undefined) => node is CommentEnumMember;
Gets if the provided node is a CommentEnumMember.
method isCommentNode
static isCommentNode: ( node: Node | undefined) => node is | CommentTypeElement | CommentStatement | CommentClassElement | CommentObjectLiteralElement | CommentEnumMember;
Gets if the provided node is a comment node.
method isCommentObjectLiteralElement
static isCommentObjectLiteralElement: ( node: Node | undefined) => node is CommentObjectLiteralElement;
Gets if the provided node is a CommentObjectLiteralElement.
method isCommentStatement
static isCommentStatement: (node: Node | undefined) => node is CommentStatement;
Gets if the provided node is a CommentStatement.
method isCommentTypeElement
static isCommentTypeElement: ( node: Node | undefined) => node is CommentTypeElement;
Gets if the provided value is a CommentTypeElement.
method isConditionalTypeNode
static isConditionalTypeNode: ( node: Node | undefined) => node is ConditionalTypeNode;
Gets if the node is a ConditionalTypeNode.
method isConstructorDeclaration
static isConstructorDeclaration: ( node: Node | undefined) => node is ConstructorDeclaration;
Gets if the node is a ConstructorDeclaration.
method isConstructorTypeNode
static isConstructorTypeNode: ( node: Node | undefined) => node is ConstructorTypeNode;
Gets if the node is a ConstructorTypeNode.
method isConstructSignatureDeclaration
static isConstructSignatureDeclaration: ( node: Node | undefined) => node is ConstructSignatureDeclaration;
Gets if the node is a ConstructSignatureDeclaration.
method isDecoratable
static isDecoratable: <T extends Node<ts.Node>>( node: T | undefined) => node is DecoratableNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is a DecoratableNode.
method isDotDotDotTokenable
static isDotDotDotTokenable: <T extends Node<ts.Node>>( node: T | undefined) => node is DotDotDotTokenableNode & DotDotDotTokenableNodeExtensionType & T;
Gets if the node is a DotDotDotTokenableNode.
method isExclamationTokenable
static isExclamationTokenable: <T extends Node<ts.Node>>( node: T | undefined) => node is ExclamationTokenableNode & ExclamationTokenableNodeExtensionType & T;
Gets if the node is an ExclamationTokenableNode.
method isExportable
static isExportable: <T extends Node<ts.Node>>( node: T | undefined) => node is ExportableNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is an ExportableNode.
method isExportGetable
static isExportGetable: <T extends Node<ts.Node>>( node: T | undefined) => node is ExportGetableNode & ExportGetableNodeExtensionType & T;
Gets if the node is an ExportGetableNode.
method isExpression
static isExpression: ( node: Node | undefined) => node is Expression<ts.Expression>;
Gets if the node is an Expression.
method isExpressionable
static isExpressionable: <T extends Node<ts.Node>>( node: T | undefined) => node is ExpressionableNode & ExpressionableNodeExtensionType & T;
Gets if the node is an ExpressionableNode.
method isExpressioned
static isExpressioned: <T extends Node<ts.Node>>( node: T | undefined) => node is ExpressionedNode & ExpressionedNodeExtensionType & T;
Gets if the node is an ExpressionedNode.
method isExtendsClauseable
static isExtendsClauseable: <T extends Node<ts.Node>>( node: T | undefined) => node is ExtendsClauseableNode & Node<ts.Node> & HeritageClauseableNode & T;
Gets if the node is an ExtendsClauseableNode.
method isFalseLiteral
static isFalseLiteral: (node: Node | undefined) => node is FalseLiteral;
Gets if the node is a FalseLiteral.
method isFirstNodeOnLine
isFirstNodeOnLine: () => boolean;
Gets if this is the first node on the current line.
method isFunctionLikeDeclaration
static isFunctionLikeDeclaration: <T extends Node<ts.Node>>( node: T | undefined) => node is FunctionLikeDeclaration & FunctionLikeDeclarationExtensionType & T;
Gets if the node is a FunctionLikeDeclaration.
method isFunctionTypeNode
static isFunctionTypeNode: (node: Node | undefined) => node is FunctionTypeNode;
Gets if the node is a FunctionTypeNode.
method isGeneratorable
static isGeneratorable: <T extends Node<ts.Node>>( node: T | undefined) => node is GeneratorableNode & GeneratorableNodeExtensionType & T;
Gets if the node is a GeneratorableNode.
method isGetAccessorDeclaration
static isGetAccessorDeclaration: ( node: Node | undefined) => node is GetAccessorDeclaration;
Gets if the node is a GetAccessorDeclaration.
method isHeritageClauseable
static isHeritageClauseable: <T extends Node<ts.Node>>( node: T | undefined) => node is HeritageClauseableNode & HeritageClauseableNodeExtensionType & T;
Gets if the node is a HeritageClauseableNode.
method isImplementsClauseable
static isImplementsClauseable: <T extends Node<ts.Node>>( node: T | undefined) => node is ImplementsClauseableNode & Node<ts.Node> & HeritageClauseableNode & T;
Gets if the node is a ImplementsClauseableNode.
method isImportAttributeNamed
static isImportAttributeNamed: <T extends Node<ts.Node>>( node: T | undefined) => node is ImportAttributeNamedNode & ImportAttributeNamedNodeExtensionType & T;
Gets if the node is a ImportAttributeNamedNode.
method isImportExpression
static isImportExpression: (node: Node | undefined) => node is ImportExpression;
Gets if the node is a ImportExpression.
method isImportTypeNode
static isImportTypeNode: (node: Node | undefined) => node is ImportTypeNode;
Gets if the node is a ImportTypeNode.
method isIndexedAccessTypeNode
static isIndexedAccessTypeNode: ( node: Node | undefined) => node is IndexedAccessTypeNode;
Gets if the node is a IndexedAccessTypeNode.
method isIndexSignatureDeclaration
static isIndexSignatureDeclaration: ( node: Node | undefined) => node is IndexSignatureDeclaration;
Gets if the node is a IndexSignatureDeclaration.
method isInferTypeNode
static isInferTypeNode: (node: Node | undefined) => node is InferTypeNode;
Gets if the node is a InferTypeNode.
method isInitializerExpressionable
static isInitializerExpressionable: <T extends Node<ts.Node>>( node: T | undefined) => node is InitializerExpressionableNode & InitializerExpressionableNodeExtensionType & T;
Gets if the node is a InitializerExpressionableNode.
method isInitializerExpressionGetable
static isInitializerExpressionGetable: <T extends Node<ts.Node>>( node: T | undefined) => node is InitializerExpressionGetableNode & InitializerExpressionGetableNodeExtensionType & T;
Gets if the node is a InitializerExpressionGetableNode.
method isInStringAtPos
isInStringAtPos: (pos: number) => boolean;
Gets if the specified position is within a string.
Parameter pos
Position.
method isInSyntaxList
isInSyntaxList: () => boolean;
Gets if this node is in a syntax list.
method isIntersectionTypeNode
static isIntersectionTypeNode: ( node: Node | undefined) => node is IntersectionTypeNode;
Gets if the node is a IntersectionTypeNode.
method isIterationStatement
static isIterationStatement: ( node: Node | undefined) => node is IterationStatement<ts.IterationStatement>;
Gets if the node is a IterationStatement.
method isJSDocable
static isJSDocable: <T extends Node<ts.Node>>( node: T | undefined) => node is JSDocableNode & JSDocableNodeExtensionType & T;
Gets if the node is a JSDocableNode.
method isJSDocPropertyLikeTag
static isJSDocPropertyLikeTag: <T extends Node<ts.Node>>( node: T | undefined) => node is JSDocPropertyLikeTag & Node<ts.JSDocPropertyLikeTag> & JSDocTag<ts.JSDocTag> & T;
Gets if the node is a JSDocPropertyLikeTag.
method isJSDocTag
static isJSDocTag: (node: Node | undefined) => node is JSDocTag<ts.JSDocTag>;
Gets if the node is a JSDocTag.
method isJSDocType
static isJSDocType: (node: Node | undefined) => node is JSDocType<ts.JSDocType>;
Gets if the node is a JSDocType.
method isJSDocTypeExpressionableTag
static isJSDocTypeExpressionableTag: <T extends Node<ts.Node>>( node: T | undefined) => node is JSDocTypeExpressionableTag & Node<any> & JSDocTag<ts.JSDocTag> & T;
Gets if the node is a JSDocTypeExpressionableTag.
method isJSDocTypeParameteredTag
static isJSDocTypeParameteredTag: <T extends Node<ts.Node>>( node: T | undefined) => node is JSDocTypeParameteredTag & Node<any> & JSDocTag<ts.JSDocTag> & T;
Gets if the node is a JSDocTypeParameteredTag.
method isJSDocUnknownTag
static isJSDocUnknownTag: (node: Node | undefined) => node is JSDocUnknownTag;
Gets if the node is a JSDocUnknownTag.
method isJsxAttributed
static isJsxAttributed: <T extends Node<ts.Node>>( node: T | undefined) => node is JsxAttributedNode & Node<any> & JsxTagNamedNode & T;
Gets if the node is a JsxAttributedNode.
method isJsxTagNamed
static isJsxTagNamed: <T extends Node<ts.Node>>( node: T | undefined) => node is JsxTagNamedNode & JsxTagNamedNodeExtensionType & T;
Gets if the node is a JsxTagNamedNode.
method isKind
isKind: <TKind extends SyntaxKind>( kind: TKind) => this is KindToNodeMappings[TKind];
Returns if the node is the specified kind.
This is a type guard.
Parameter kind
Syntax kind.
method isLeftHandSideExpression
static isLeftHandSideExpression: ( node: Node | undefined) => node is LeftHandSideExpression<ts.LeftHandSideExpression>;
Gets if the node is a LeftHandSideExpression.
method isLeftHandSideExpressioned
static isLeftHandSideExpressioned: <T extends Node<ts.Node>>( node: T | undefined) => node is LeftHandSideExpressionedNode & LeftHandSideExpressionedNodeExtensionType & T;
Gets if the node is a LeftHandSideExpressionedNode.
method isLiteralExpression
static isLiteralExpression: ( node: Node | undefined) => node is LiteralExpression<ts.LiteralExpression>;
Gets if the node is a LiteralExpression.
method isLiteralLike
static isLiteralLike: <T extends Node<ts.Node>>( node: T | undefined) => node is LiteralLikeNode & LiteralLikeNodeExtensionType & T;
Gets if the node is a LiteralLikeNode.
method isLiteralTypeNode
static isLiteralTypeNode: (node: Node | undefined) => node is LiteralTypeNode;
Gets if the node is a LiteralTypeNode.
method isMappedTypeNode
static isMappedTypeNode: (node: Node | undefined) => node is MappedTypeNode;
Gets if the node is a MappedTypeNode.
method isMemberExpression
static isMemberExpression: ( node: Node | undefined) => node is MemberExpression<ts.MemberExpression>;
Gets if the node is a MemberExpression.
method isModifierable
static isModifierable: <T extends Node<ts.Node>>( node: T | undefined) => node is ModifierableNode & ModifierableNodeExtensionType & T;
Gets if the node is a ModifierableNode.
method isModuleChildable
static isModuleChildable: <T extends Node<ts.Node>>( node: T | undefined) => node is ModuleChildableNode & ModuleChildableNodeExtensionType & T;
Gets if the node is a ModuleChildableNode.
method isModuled
static isModuled: <T extends Node<ts.Node>>( node: T | undefined) => node is ModuledNode & Node<any> & StatementedNode & T;
Gets if the node is a ModuledNode.
method isModuleNamed
static isModuleNamed: <T extends Node<ts.Node>>( node: T | undefined) => node is ModuleNamedNode & ModuleNamedNodeExtensionType & T;
Gets if the node is a ModuleNamedNode.
method isNameable
static isNameable: <T extends Node<ts.Node>>( node: T | undefined) => node is NameableNode & NameableNodeExtensionType & T;
Gets if the node is a NameableNode.
method isNamed
static isNamed: <T extends Node<ts.Node>>( node: T | undefined) => node is NamedNode & NamedNodeExtensionType & T;
Gets if the node is a NamedNode.
method isNode
static isNode: (value: unknown) => value is Node<ts.Node>;
Gets if the provided value is a Node.
method isNodeWithTypeArguments
static isNodeWithTypeArguments: ( node: Node | undefined) => node is NodeWithTypeArguments<ts.NodeWithTypeArguments>;
Gets if the node is a NodeWithTypeArguments.
method isNullLiteral
static isNullLiteral: (node: Node | undefined) => node is NullLiteral;
Gets if the node is a NullLiteral.
method isOverloadable
static isOverloadable: <T extends Node<ts.Node>>( node: T | undefined) => node is OverloadableNode & Node<ts.Node> & BodyableNode & T;
Gets if the node is a OverloadableNode.
method isOverrideable
static isOverrideable: <T extends Node<ts.Node>>( node: T | undefined) => node is OverrideableNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is a OverrideableNode.
method isParameterDeclaration
static isParameterDeclaration: ( node: Node | undefined) => node is ParameterDeclaration;
Gets if the node is a ParameterDeclaration.
method isParametered
static isParametered: <T extends Node<ts.Node>>( node: T | undefined) => node is ParameteredNode & ParameteredNodeExtensionType & T;
Gets if the node is a ParameteredNode.
method isParenthesizedTypeNode
static isParenthesizedTypeNode: ( node: Node | undefined) => node is ParenthesizedTypeNode;
Gets if the node is a ParenthesizedTypeNode.
method isPrimaryExpression
static isPrimaryExpression: ( node: Node | undefined) => node is PrimaryExpression<ts.PrimaryExpression>;
Gets if the node is a PrimaryExpression.
method isPropertyNamed
static isPropertyNamed: <T extends Node<ts.Node>>( node: T | undefined) => node is PropertyNamedNode & PropertyNamedNodeExtensionType & T;
Gets if the node is a PropertyNamedNode.
method isQuestionDotTokenable
static isQuestionDotTokenable: <T extends Node<ts.Node>>( node: T | undefined) => node is QuestionDotTokenableNode & QuestionDotTokenableNodeExtensionType & T;
Gets if the node is a QuestionDotTokenableNode.
method isQuestionTokenable
static isQuestionTokenable: <T extends Node<ts.Node>>( node: T | undefined) => node is QuestionTokenableNode & QuestionTokenableNodeExtensionType & T;
Gets if the node is a QuestionTokenableNode.
method isReadonlyable
static isReadonlyable: <T extends Node<ts.Node>>( node: T | undefined) => node is ReadonlyableNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is a ReadonlyableNode.
method isReferenceFindable
static isReferenceFindable: <T extends Node<ts.Node>>( node: T | undefined) => node is ReferenceFindableNode & ReferenceFindableNodeExtensionType & T;
Gets if the node is a ReferenceFindableNode.
method isRenameable
static isRenameable: <T extends Node<ts.Node>>( node: T | undefined) => node is RenameableNode & RenameableNodeExtensionType & T;
Gets if the node is a RenameableNode.
method isRestTypeNode
static isRestTypeNode: (node: Node | undefined) => node is RestTypeNode;
Gets if the node is a RestTypeNode.
method isReturnTyped
static isReturnTyped: <T extends Node<ts.Node>>( node: T | undefined) => node is ReturnTypedNode & ReturnTypedNodeExtensionType & T;
Gets if the node is a ReturnTypedNode.
method isScopeable
static isScopeable: <T extends Node<ts.Node>>( node: T | undefined) => node is ScopeableNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is a ScopeableNode.
method isScoped
static isScoped: <T extends Node<ts.Node>>( node: T | undefined) => node is ScopedNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is a ScopedNode.
method isSetAccessorDeclaration
static isSetAccessorDeclaration: ( node: Node | undefined) => node is SetAccessorDeclaration;
Gets if the node is a SetAccessorDeclaration.
method isSignaturedDeclaration
static isSignaturedDeclaration: <T extends Node<ts.Node>>( node: T | undefined) => node is SignaturedDeclaration & SignaturedDeclarationExtensionType & T;
Gets if the node is a SignaturedDeclaration.
method isStatement
static isStatement: (node: Node | undefined) => node is Statement<ts.Statement>;
Gets if the node is a Statement.
method isStatemented
static isStatemented: <T extends Node<ts.Node>>( node: T | undefined) => node is StatementedNode & StatementedNodeExtensionType & T;
Gets if the node is a StatementedNode.
method isStaticable
static isStaticable: <T extends Node<ts.Node>>( node: T | undefined) => node is StaticableNode & Node<ts.Node> & ModifierableNode & T;
Gets if the node is a StaticableNode.
method isSuperExpression
static isSuperExpression: (node: Node | undefined) => node is SuperExpression;
Gets if the node is a SuperExpression.
method isTemplateLiteralTypeNode
static isTemplateLiteralTypeNode: ( node: Node | undefined) => node is TemplateLiteralTypeNode;
Gets if the node is a TemplateLiteralTypeNode.
method isTextInsertable
static isTextInsertable: <T extends Node<ts.Node>>( node: T | undefined) => node is TextInsertableNode & TextInsertableNodeExtensionType & T;
Gets if the node is a TextInsertableNode.
method isThisExpression
static isThisExpression: (node: Node | undefined) => node is ThisExpression;
Gets if the node is a ThisExpression.
method isThisTypeNode
static isThisTypeNode: (node: Node | undefined) => node is ThisTypeNode;
Gets if the node is a ThisTypeNode.
method isTrueLiteral
static isTrueLiteral: (node: Node | undefined) => node is TrueLiteral;
Gets if the node is a TrueLiteral.
method isTupleTypeNode
static isTupleTypeNode: (node: Node | undefined) => node is TupleTypeNode;
Gets if the node is a TupleTypeNode.
method isTypeArgumented
static isTypeArgumented: <T extends Node<ts.Node>>( node: T | undefined) => node is TypeArgumentedNode & TypeArgumentedNodeExtensionType & T;
Gets if the node is a TypeArgumentedNode.
method isTypeAssertion
static isTypeAssertion: (node: Node | undefined) => node is TypeAssertion;
Gets if the node is a TypeAssertion.
method isTyped
static isTyped: <T extends Node<ts.Node>>( node: T | undefined) => node is TypedNode & TypedNodeExtensionType & T;
Gets if the node is a TypedNode.
method isTypeElement
static isTypeElement: ( node: Node | undefined) => node is TypeElement<ts.TypeElement>;
Gets if the node is a TypeElement.
method isTypeElementMembered
static isTypeElementMembered: <T extends Node<ts.Node>>( node: T | undefined) => node is TypeElementMemberedNode & TypeElementMemberedNodeExtensionType & T;
Gets if the node is a TypeElementMemberedNode.
method isTypeLiteral
static isTypeLiteral: (node: Node | undefined) => node is TypeLiteralNode;
Gets if the node is a TypeLiteralNode.
method isTypeNode
static isTypeNode: (node: Node | undefined) => node is TypeNode<ts.TypeNode>;
Gets if the node is a TypeNode.
method isTypeOperatorTypeNode
static isTypeOperatorTypeNode: ( node: Node | undefined) => node is TypeOperatorTypeNode;
Gets if the node is a TypeOperatorTypeNode.
method isTypeParameterDeclaration
static isTypeParameterDeclaration: ( node: Node | undefined) => node is TypeParameterDeclaration;
Gets if the node is a TypeParameterDeclaration.
method isTypeParametered
static isTypeParametered: <T extends Node<ts.Node>>( node: T | undefined) => node is TypeParameteredNode & TypeParameteredNodeExtensionType & T;
Gets if the node is a TypeParameteredNode.
method isTypePredicate
static isTypePredicate: (node: Node | undefined) => node is TypePredicateNode;
Gets if the node is a TypePredicateNode.
method isTypeQuery
static isTypeQuery: (node: Node | undefined) => node is TypeQueryNode;
Gets if the node is a TypeQueryNode.
method isTypeReference
static isTypeReference: (node: Node | undefined) => node is TypeReferenceNode;
Gets if the node is a TypeReferenceNode.
method isUnaryExpression
static isUnaryExpression: ( node: Node | undefined) => node is UnaryExpression<ts.UnaryExpression>;
Gets if the node is a UnaryExpression.
method isUnaryExpressioned
static isUnaryExpressioned: <T extends Node<ts.Node>>( node: T | undefined) => node is UnaryExpressionedNode & UnaryExpressionedNodeExtensionType & T;
Gets if the node is a UnaryExpressionedNode.
method isUnionTypeNode
static isUnionTypeNode: (node: Node | undefined) => node is UnionTypeNode;
Gets if the node is a UnionTypeNode.
method isUnwrappable
static isUnwrappable: <T extends Node<ts.Node>>( node: T | undefined) => node is UnwrappableNode & UnwrappableNodeExtensionType & T;
Gets if the node is a UnwrappableNode.
method isUpdateExpression
static isUpdateExpression: ( node: Node | undefined) => node is UpdateExpression<ts.UpdateExpression>;
Gets if the node is a UpdateExpression.
method prependWhitespace
prependWhitespace: (textOrWriterFunction: string | WriterFunction) => void;
Prepends the specified whitespace to current node.
Parameter textOrWriterFunction
Text or writer function.
method print
print: (options?: PrintNodeOptions) => string;
Prints the node using the compiler's printer.
Parameter options
Options.
method replaceWithText
replaceWithText: (textOrWriterFunction: string | WriterFunction) => Node;
Replaces the text of the current node with new text.
This will forget the current node and return a new node that can be asserted or type guarded to the correct type.
Parameter textOrWriterFunction
Text or writer function to replace with.
Returns
The new node.
Remarks
This will replace the text from the
Node#getStart(true)
position (start position with js docs) toNode#getEnd()
. UseNode#getText(true)
to get all the text that will be replaced.
method transform
transform: ( visitNode: (traversal: TransformTraversalControl) => ts.Node) => Node;
Transforms the node using the compiler api nodes and functions and returns the node that was transformed (experimental).
WARNING: This will forget descendants of transformed nodes and potentially this node.
Example 1
Increments all the numeric literals in a source file.
sourceFile.transform(traversal => {const node = traversal.visitChildren(); // recommend always visiting the children first (post order)if (ts.isNumericLiteral(node))return ts.createNumericLiteral((parseInt(node.text, 10) + 1).toString());return node;});Example 2
Updates the class declaration node without visiting the children.
const classDec = sourceFile.getClassOrThrow("MyClass");classDec.transform(traversal => {const node = traversal.currentNode;return ts.updateClassDeclaration(node, undefined, undefined, ts.createIdentifier("MyUpdatedClass"), undefined, undefined, []);});
method wasForgotten
wasForgotten: () => boolean;
Gets if the compiler node was forgotten.
This will be true when the compiler node was forgotten or removed.
class NodeWithTypeArguments
class NodeWithTypeArguments< T extends ts.NodeWithTypeArguments = ts.NodeWithTypeArguments> extends NodeWithTypeArgumentsBase<T> {}
class NonNullExpression
class NonNullExpression extends NonNullExpressionBase<ts.NonNullExpression> {}
method getParent
getParent: () => NodeParentType<ts.NonNullExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NonNullExpression>>;
*
class NoSubstitutionTemplateLiteral
class NoSubstitutionTemplateLiteral extends NoSubstitutionTemplateLiteralBase<ts.NoSubstitutionTemplateLiteral> {}
method getLiteralValue
getLiteralValue: () => string;
Gets the literal value.
method getParent
getParent: () => NodeParentType<ts.NoSubstitutionTemplateLiteral>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NoSubstitutionTemplateLiteral>>;
*
method setLiteralValue
setLiteralValue: (value: string) => TemplateLiteral;
Sets the literal value.
Note: This could possibly replace the node if you add a tagged template.
Parameter value
Value to set.
Returns
The new node if the kind changed; the current node otherwise.
class NotEmittedStatement
class NotEmittedStatement extends NotEmittedStatementBase<ts.NotEmittedStatement> {}
method getParent
getParent: () => NodeParentType<ts.NotEmittedStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NotEmittedStatement>>;
*
class NullLiteral
class NullLiteral extends NullLiteralBase<ts.NullLiteral> {}
method getParent
getParent: () => NodeParentType<ts.NullLiteral>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NullLiteral>>;
*
class NumericLiteral
class NumericLiteral extends NumericLiteralBase<ts.NumericLiteral> {}
method getLiteralValue
getLiteralValue: () => number;
Gets the literal value.
method getParent
getParent: () => NodeParentType<ts.NumericLiteral>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.NumericLiteral>>;
*
method setLiteralValue
setLiteralValue: (value: number) => this;
Sets the literal value.
Parameter value
Value to set.
class ObjectBindingPattern
class ObjectBindingPattern extends Node<ts.ObjectBindingPattern> {}
method getElements
getElements: () => BindingElement[];
Gets the object binding pattern's elements.
method getParent
getParent: () => NodeParentType<ts.ObjectBindingPattern>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ObjectBindingPattern>>;
*
class ObjectDestructuringAssignment
class ObjectDestructuringAssignment extends ObjectDestructuringAssignmentBase<ts.ObjectDestructuringAssignment> {}
method getLeft
getLeft: () => ObjectLiteralExpression;
Gets the left object literal expression of the object destructuring assignment.
method getParent
getParent: () => NodeParentType<ts.ObjectDestructuringAssignment>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ObjectDestructuringAssignment>>;
*
class ObjectLiteralElement
class ObjectLiteralElement< T extends ts.ObjectLiteralElement = ts.ObjectLiteralElement> extends Node<T> {}
method remove
remove: () => void;
Removes the object literal element from the object literal expression.
class ObjectLiteralExpression
class ObjectLiteralExpression extends ObjectLiteralExpressionBase<ts.ObjectLiteralExpression> {}
method addGetAccessor
addGetAccessor: ( structure: OptionalKind<GetAccessorDeclarationStructure>) => GetAccessorDeclaration;
Adds a get accessor.
Parameter structure
Structure that represents the property assignment to add.
method addGetAccessors
addGetAccessors: ( structures: ReadonlyArray<OptionalKind<GetAccessorDeclarationStructure>>) => GetAccessorDeclaration[];
Adds get accessors.
Parameter structures
Structure that represents the get accessors to add.
method addMethod
addMethod: ( structure: OptionalKind<MethodDeclarationStructure>) => MethodDeclaration;
Adds a method.
Parameter structure
Structure that represents the method to add.
method addMethods
addMethods: ( structures: ReadonlyArray<OptionalKind<MethodDeclarationStructure>>) => MethodDeclaration[];
Adds methods.
Parameter structures
Structure that represents the methods to add.
method addProperties
addProperties: ( structures: | string | WriterFunction | ReadonlyArray< string | WriterFunction | ObjectLiteralExpressionPropertyStructures >) => (CommentObjectLiteralElement | ObjectLiteralElementLike)[];
Adds the specified properties to the object literal expression.
Note: If you only want to add property assignments, then it might be more convenient to use #addPropertyAssignments. - The structures to add.
method addProperty
addProperty: ( structure: | string | WriterFunction | ObjectLiteralExpressionPropertyStructures) => CommentObjectLiteralElement | ObjectLiteralElementLike;
Adds the specified property to the object literal expression.
Note: If you only want to add a property assignment, then it might be more convenient to use #addPropertyAssignment. - The structure to add.
method addPropertyAssignment
addPropertyAssignment: ( structure: OptionalKind<PropertyAssignmentStructure>) => PropertyAssignment;
Adds a property assignment.
Parameter structure
Structure that represents the property assignment to add.
method addPropertyAssignments
addPropertyAssignments: ( structures: ReadonlyArray<OptionalKind<PropertyAssignmentStructure>>) => PropertyAssignment[];
Adds property assignments.
Parameter structures
Structure that represents the property assignments to add.
method addSetAccessor
addSetAccessor: ( structure: OptionalKind<SetAccessorDeclarationStructure>) => SetAccessorDeclaration;
Adds a set accessor.
Parameter structure
Structure that represents the property assignment to add.
method addSetAccessors
addSetAccessors: ( structures: ReadonlyArray<OptionalKind<SetAccessorDeclarationStructure>>) => SetAccessorDeclaration[];
Adds set accessors.
Parameter structures
Structure that represents the set accessors to add.
method addShorthandPropertyAssignment
addShorthandPropertyAssignment: ( structure: OptionalKind<ShorthandPropertyAssignmentStructure>) => ShorthandPropertyAssignment;
Adds a shorthand property assignment.
Parameter structure
Structure that represents the shorthand property assignment to add.
method addShorthandPropertyAssignments
addShorthandPropertyAssignments: ( structures: ReadonlyArray<OptionalKind<ShorthandPropertyAssignmentStructure>>) => ShorthandPropertyAssignment[];
Adds shorthand property assignments.
Parameter structures
Structure that represents the shorthand property assignments to add.
method addSpreadAssignment
addSpreadAssignment: ( structure: OptionalKind<SpreadAssignmentStructure>) => SpreadAssignment;
Adds a spread assignment.
Parameter structure
Structure that represents the spread assignment to add.
method addSpreadAssignments
addSpreadAssignments: ( structures: ReadonlyArray<OptionalKind<SpreadAssignmentStructure>>) => SpreadAssignment[];
Adds spread assignments.
Parameter structures
Structure that represents the spread assignments to add.
method getParent
getParent: () => NodeParentType<ts.ObjectLiteralExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ObjectLiteralExpression>>;
*
method getProperties
getProperties: () => ObjectLiteralElementLike[];
Gets the properties.
method getPropertiesWithComments
getPropertiesWithComments: () => ( | ObjectLiteralElementLike | CommentObjectLiteralElement)[];
Gets the properties with comment object literal elements.
method getProperty
getProperty: { (name: string): ObjectLiteralElementLike | undefined; ( findFunction: (property: ObjectLiteralElementLike) => boolean ): ObjectLiteralElementLike;};
Gets the first property by the provided name or returns undefined.
Parameter name
Name of the property.
Gets the first property that matches the provided find function or returns undefined.
Parameter findFunction
Find function.
method getPropertyOrThrow
getPropertyOrThrow: { (name: string): ObjectLiteralElementLike; ( findFunction: (property: ObjectLiteralElementLike) => boolean ): ObjectLiteralElementLike;};
Gets the first property by the provided name or throws.
Parameter name
Name of the property.
Gets the first property that matches the provided find function or throws.
Parameter findFunction
Find function.
method insertGetAccessor
insertGetAccessor: ( index: number, structure: OptionalKind<GetAccessorDeclarationStructure>) => GetAccessorDeclaration;
Inserts a get accessor at the specified index.
Parameter index
Child index to insert at.
Parameter structure
Structure that represents the get accessor to insert.
method insertGetAccessors
insertGetAccessors: ( index: number, structures: ReadonlyArray<OptionalKind<GetAccessorDeclarationStructure>>) => GetAccessorDeclaration[];
Inserts get accessors at the specified index.
Parameter index
Child index to insert at.
Parameter structures
Structures that represent the get accessors to insert.
method insertMethod
insertMethod: ( index: number, structure: OptionalKind<MethodDeclarationStructure>) => MethodDeclaration;
Inserts a method at the specified index.
Parameter index
Child index to insert at.
Parameter structure
Structure that represents the method to insert.
method insertMethods
insertMethods: ( index: number, structures: ReadonlyArray<OptionalKind<MethodDeclarationStructure>>) => MethodDeclaration[];
Inserts methods at the specified index.
Parameter index
Child index to insert at.
Parameter structures
Structures that represent the methods to insert.
method insertProperties
insertProperties: ( index: number, structures: | string | WriterFunction | ReadonlyArray< string | WriterFunction | ObjectLiteralExpressionPropertyStructures >) => (CommentObjectLiteralElement | ObjectLiteralElementLike)[];
Inserts the specified properties to the object literal expression.
Note: If you only want to insert property assignments, then it might be more convenient to use #insertPropertyAssignments. - The index to insert at. - The structures to insert.
method insertProperty
insertProperty: ( index: number, structure: | string | WriterFunction | ObjectLiteralExpressionPropertyStructures) => CommentObjectLiteralElement | ObjectLiteralElementLike;
Inserts the specified property to the object literal expression.
Note: If you only want to insert a property assignment, then it might be more convenient to use #insertPropertyAssignment. - The index to insert at. - The structure to insert.
method insertPropertyAssignment
insertPropertyAssignment: ( index: number, structure: OptionalKind<PropertyAssignmentStructure>) => PropertyAssignment;
Inserts a property assignment at the specified index.
Parameter index
Child index to insert at.
Parameter structure
Structure that represents the property assignment to insert.
method insertPropertyAssignments
insertPropertyAssignments: ( index: number, structures: ReadonlyArray<OptionalKind<PropertyAssignmentStructure>>) => PropertyAssignment[];
Inserts property assignments at the specified index.
Parameter index
Child index to insert at.
Parameter structures
Structures that represent the property assignments to insert.
method insertSetAccessor
insertSetAccessor: ( index: number, structure: OptionalKind<SetAccessorDeclarationStructure>) => SetAccessorDeclaration;
Inserts a set accessor at the specified index.
Parameter index
Child index to insert at.
Parameter structure
Structure that represents the set accessor to insert.
method insertSetAccessors
insertSetAccessors: ( index: number, structures: ReadonlyArray<OptionalKind<SetAccessorDeclarationStructure>>) => SetAccessorDeclaration[];
Inserts set accessors at the specified index.
Parameter index
Child index to insert at.
Parameter structures
Structures that represent the set accessors to insert.
method insertShorthandPropertyAssignment
insertShorthandPropertyAssignment: ( index: number, structure: OptionalKind<ShorthandPropertyAssignmentStructure>) => ShorthandPropertyAssignment;
Inserts a shorthand property assignment at the specified index.
Parameter index
Child index to insert at.
Parameter structure
Structure that represents the shorthand property assignment to insert.
method insertShorthandPropertyAssignments
insertShorthandPropertyAssignments: ( index: number, structures: ReadonlyArray<OptionalKind<ShorthandPropertyAssignmentStructure>>) => ShorthandPropertyAssignment[];
Inserts shorthand property assignments at the specified index.
Parameter index
Child index to insert at.
Parameter structures
Structures that represent the shorthand property assignments to insert.
method insertSpreadAssignment
insertSpreadAssignment: ( index: number, structure: OptionalKind<SpreadAssignmentStructure>) => SpreadAssignment;
Inserts a spread assignment at the specified index.
Parameter index
Child index to insert at.
Parameter structure
Structure that represents the spread assignment to insert.
method insertSpreadAssignments
insertSpreadAssignments: ( index: number, structures: ReadonlyArray<OptionalKind<SpreadAssignmentStructure>>) => SpreadAssignment[];
Inserts spread assignments at the specified index.
Parameter index
Child index to insert at.
Parameter structures
Structures that represent the spread assignments to insert.
class OmittedExpression
class OmittedExpression extends OmittedExpressionBase<ts.OmittedExpression> {}
method getParent
getParent: () => NodeParentType<ts.OmittedExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.OmittedExpression>>;
*
class OutputFile
class OutputFile {}
Output file of an emit.
property compilerObject
readonly compilerObject: ts.OutputFile;
TypeScript compiler output file.
method getFilePath
getFilePath: () => StandardizedFilePath;
Gets the file path.
method getText
getText: () => string;
Gets the file text.
method getWriteByteOrderMark
getWriteByteOrderMark: () => boolean;
Gets whether the byte order mark should be written.
class ParameterDeclaration
class ParameterDeclaration extends ParameterDeclarationBase<ts.ParameterDeclaration> {}
method getParent
getParent: () => NodeParentType<ts.ParameterDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ParameterDeclaration>>;
*
method getStructure
getStructure: () => ParameterDeclarationStructure;
Gets the structure equivalent to this node.
method isOptional
isOptional: () => boolean;
Gets if it's optional.
method isParameterProperty
isParameterProperty: () => boolean;
Gets if this is a property with a scope, readonly, or override keyword (found in class constructors).
method isRestParameter
isRestParameter: () => boolean;
Gets if it's a rest parameter.
method remove
remove: () => void;
Remove this parameter.
method set
set: (structure: Partial<ParameterDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setHasQuestionToken
setHasQuestionToken: (value: boolean) => this;
Sets if this node has a question token.
Parameter value
If it should have a question token or not.
method setInitializer
setInitializer: (textOrWriterFunction: string | WriterFunction) => this;
Sets the initializer.
Parameter text
Text or writer function to set for the initializer.
method setIsRestParameter
setIsRestParameter: (value: boolean) => this;
Sets if it's a rest parameter.
Parameter value
Sets if it's a rest parameter or not.
method setType
setType: (textOrWriterFunction: string | WriterFunction) => this;
Sets the type.
Parameter textOrWriterFunction
Text or writer function to set the type with.
class ParenthesizedExpression
class ParenthesizedExpression extends ParenthesizedExpressionBase<ts.ParenthesizedExpression> {}
method getParent
getParent: () => NodeParentType<ts.ParenthesizedExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ParenthesizedExpression>>;
*
class ParenthesizedTypeNode
class ParenthesizedTypeNode extends TypeNode<ts.ParenthesizedTypeNode> {}
method getParent
getParent: () => NodeParentType<ts.ParenthesizedTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ParenthesizedTypeNode>>;
*
method getTypeNode
getTypeNode: () => TypeNode;
Gets the node within the parentheses.
method setType
setType: (textOrWriterFunction: string | WriterFunction) => this;
Sets the type within the parentheses.
Parameter textOrWriterFunction
Text or writer function to set the type with.
class PartiallyEmittedExpression
class PartiallyEmittedExpression extends PartiallyEmittedExpressionBase<ts.PartiallyEmittedExpression> {}
method getParent
getParent: () => NodeParentType<ts.PartiallyEmittedExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.PartiallyEmittedExpression>>;
*
class PostfixUnaryExpression
class PostfixUnaryExpression extends PostfixUnaryExpressionBase<ts.PostfixUnaryExpression> {}
method getOperand
getOperand: () => LeftHandSideExpression;
Gets the operand of the postfix unary expression.
method getOperatorToken
getOperatorToken: () => ts.PostfixUnaryOperator;
Gets the operator token of the postfix unary expression.
method getParent
getParent: () => NodeParentType<ts.PostfixUnaryExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.PostfixUnaryExpression>>;
*
class PrefixUnaryExpression
class PrefixUnaryExpression extends PrefixUnaryExpressionBase<ts.PrefixUnaryExpression> {}
method getOperand
getOperand: () => UnaryExpression;
Gets the operand of the prefix unary expression.
method getOperatorToken
getOperatorToken: () => ts.PrefixUnaryOperator;
Gets the operator token of the prefix unary expression.
method getParent
getParent: () => NodeParentType<ts.PrefixUnaryExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.PrefixUnaryExpression>>;
*
class PrimaryExpression
class PrimaryExpression< T extends ts.PrimaryExpression = ts.PrimaryExpression> extends MemberExpression<T> {}
class PrivateIdentifier
class PrivateIdentifier extends PrivateIdentifierBase<ts.PrivateIdentifier> {}
method getParent
getParent: () => NodeParentType<ts.PrivateIdentifier>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.PrivateIdentifier>>;
*
class Program
class Program {}
Wrapper around Program.
property compilerObject
readonly compilerObject: ts.Program;
Gets the underlying compiler program.
method emit
emit: (options?: ProgramEmitOptions) => Promise<EmitResult>;
Asynchronously emits the TypeScript files as JavaScript files.
Parameter options
Options for emitting.
method emitSync
emitSync: (options?: ProgramEmitOptions) => EmitResult;
Synchronously emits the TypeScript files as JavaScript files.
Parameter options
Options for emitting.
Remarks
Use
emit()
as the asynchronous version will be much faster.
method emitToMemory
emitToMemory: (options?: EmitOptions) => MemoryEmitResult;
Emits the TypeScript files to JavaScript files to memory.
Parameter options
Options for emitting.
method getConfigFileParsingDiagnostics
getConfigFileParsingDiagnostics: () => Diagnostic[];
Gets the diagnostics found when parsing the tsconfig.json file.
method getDeclarationDiagnostics
getDeclarationDiagnostics: (sourceFile?: SourceFile) => DiagnosticWithLocation[];
Gets the declaration diagnostics.
Parameter sourceFile
Optional source file to filter by.
method getEmitModuleResolutionKind
getEmitModuleResolutionKind: () => ModuleResolutionKind;
Gets the emit module resolution kind.
method getGlobalDiagnostics
getGlobalDiagnostics: () => Diagnostic[];
Gets the global diagnostics.
method getSemanticDiagnostics
getSemanticDiagnostics: (sourceFile?: SourceFile) => Diagnostic[];
Gets the semantic diagnostics.
Parameter sourceFile
Optional source file to filter by.
method getSyntacticDiagnostics
getSyntacticDiagnostics: (sourceFile?: SourceFile) => DiagnosticWithLocation[];
Gets the syntactic diagnostics.
Parameter sourceFile
Optional source file to filter by.
method getTypeChecker
getTypeChecker: () => TypeChecker;
Get the program's type checker.
method isSourceFileFromExternalLibrary
isSourceFileFromExternalLibrary: (sourceFile: SourceFile) => boolean;
Gets if the provided source file was discovered while loading an external library.
Parameter sourceFile
Source file.
class Project
class Project {}
Project that holds source files.
constructor
constructor(options?: ProjectOptions);
Initializes a new instance.
Parameter options
Optional options.
property compilerOptions
readonly compilerOptions: CompilerOptionsContainer;
Gets the compiler options for modification.
property manipulationSettings
readonly manipulationSettings: ManipulationSettingsContainer;
Gets the manipulation settings.
method addDirectoryAtPath
addDirectoryAtPath: ( dirPath: string, options?: DirectoryAddOptions) => Directory;
Adds an existing directory from the path or throws if it doesn't exist.
Will return the directory if it was already added.
Parameter dirPath
Path to add the directory at.
Parameter options
Options.
Throws
DirectoryNotFoundError when the directory does not exist.
method addDirectoryAtPathIfExists
addDirectoryAtPathIfExists: ( dirPath: string, options?: DirectoryAddOptions) => Directory | undefined;
Adds an existing directory from the path or returns undefined if it doesn't exist.
Will return the directory if it was already added.
Parameter dirPath
Path to add the directory at.
Parameter options
Options.
method addSourceFileAtPath
addSourceFileAtPath: (filePath: string) => SourceFile;
Adds an existing source file from a file path or throws if it doesn't exist.
Will return the source file if it was already added.
Parameter filePath
File path to get the file from.
Throws
FileNotFoundError when the file is not found.
method addSourceFileAtPathIfExists
addSourceFileAtPathIfExists: (filePath: string) => SourceFile | undefined;
Adds a source file from a file path if it exists or returns undefined.
Will return the source file if it was already added.
Parameter filePath
File path to get the file from.
method addSourceFilesAtPaths
addSourceFilesAtPaths: ( fileGlobs: string | ReadonlyArray<string>) => SourceFile[];
Adds source files based on file globs.
Parameter fileGlobs
File glob or globs to add files based on.
Returns
The matched source files.
method addSourceFilesFromTsConfig
addSourceFilesFromTsConfig: (tsConfigFilePath: string) => SourceFile[];
Adds all the source files from the specified tsconfig.json.
Note that this is done by default when specifying a tsconfig file in the constructor and not explicitly setting the
skipAddingFilesFromTsConfig
option totrue
.Parameter tsConfigFilePath
File path to the tsconfig.json file.
method createDirectory
createDirectory: (dirPath: string) => Directory;
Creates a directory at the specified path.
Parameter dirPath
Path to create the directory at.
method createSourceFile
createSourceFile: ( filePath: string, sourceFileText?: string | OptionalKind<SourceFileStructure> | WriterFunction, options?: SourceFileCreateOptions) => SourceFile;
Creates a source file at the specified file path with the specified text.
Note: The file will not be created and saved to the file system until .save() is called on the source file.
Parameter filePath
File path of the source file.
Parameter sourceFileText
Text, structure, or writer function for the source file text.
Parameter options
Options.
Throws
- InvalidOperationError if a source file already exists at the provided file path.
method createWriter
createWriter: () => CodeBlockWriter;
Creates a writer with the current manipulation settings.
Remarks
Generally it's best to use a provided writer, but this may be useful in some scenarios.
method emit
emit: (emitOptions?: EmitOptions) => Promise<EmitResult>;
Asynchronously emits all the source files to the file system as JavaScript files.
Parameter emitOptions
Optional emit options.
method emitSync
emitSync: (emitOptions?: EmitOptions) => EmitResult;
Synchronously emits all the source files to the file system as JavaScript files.
Parameter emitOptions
Optional emit options.
method emitToMemory
emitToMemory: (emitOptions?: EmitOptions) => MemoryEmitResult;
Emits all the source files to memory.
Parameter emitOptions
Optional emit options.
method enableLogging
enableLogging: (enabled?: boolean) => void;
Enables logging to the console.
Parameter enabled
Enabled.
method forgetNodesCreatedInBlock
forgetNodesCreatedInBlock: { <T = void>(block: (remember: (...node: Node[]) => void) => T): T; <T = void>( block: (remember: (...node: Node<ts.Node>[]) => void) => Promise<T> ): Promise<T>;};
Forgets the nodes created in the scope of the passed in block.
This is an advanced method that can be used to easily "forget" all the nodes created within the scope of the block.
Parameter block
Block of code to run. Use the
remember
callback or return a node to remember it.Forgets the nodes created in the scope of the passed in block asynchronously.
This is an advanced method that can be used to easily "forget" all the nodes created within the scope of the block.
Parameter block
Block of code to run. Use the
remember
callback or return a node to remember it.
method formatDiagnosticsWithColorAndContext
formatDiagnosticsWithColorAndContext: ( diagnostics: ReadonlyArray<Diagnostic>, opts?: { newLineChar?: '\n' | '\r\n' }) => string;
Formats an array of diagnostics with their color and context into a string.
Parameter diagnostics
Diagnostics to get a string of.
Parameter options
Collection of options. For example, the new line character to use (defaults to the OS' new line character).
method getAmbientModule
getAmbientModule: (moduleName: string) => Symbol | undefined;
Gets the specified ambient module symbol or returns undefined if not found.
Parameter moduleName
The ambient module name with or without quotes.
method getAmbientModuleOrThrow
getAmbientModuleOrThrow: ( moduleName: string, message?: string | (() => string)) => Symbol;
Gets the specified ambient module symbol or throws if not found.
Parameter moduleName
The ambient module name with or without quotes.
method getAmbientModules
getAmbientModules: () => Symbol[];
Gets the ambient module symbols (ex. modules in the folder or node_modules).
method getCompilerOptions
getCompilerOptions: () => CompilerOptions;
Gets the compiler options.
method getConfigFileParsingDiagnostics
getConfigFileParsingDiagnostics: () => Diagnostic[];
Gets the diagnostics found when parsing the tsconfig.json file provided in the project's constructor.
method getDirectories
getDirectories: () => Directory[];
Gets all the directories.
method getDirectory
getDirectory: (dirPath: string) => Directory | undefined;
Gets a directory by the specified path or returns undefined if it doesn't exist.
Parameter dirPath
Directory path.
method getDirectoryOrThrow
getDirectoryOrThrow: ( dirPath: string, message?: string | (() => string)) => Directory;
Gets a directory by the specified path or throws if it doesn't exist.
Parameter dirPath
Path to create the directory at.
method getFileSystem
getFileSystem: () => FileSystemHost;
Gets the file system.
method getLanguageService
getLanguageService: () => LanguageService;
Gets the language service.
method getModuleResolutionHost
getModuleResolutionHost: () => ts.ModuleResolutionHost;
Gets a ts.ModuleResolutionHost for the project.
method getPreEmitDiagnostics
getPreEmitDiagnostics: () => Diagnostic[];
Gets the pre-emit diagnostics.
method getProgram
getProgram: () => Program;
Gets the program.
method getRootDirectories
getRootDirectories: () => Directory[];
Gets the directories without a parent.
method getSourceFile
getSourceFile: { (fileNameOrPath: string): SourceFile | undefined; (searchFunction: (file: SourceFile) => boolean): SourceFile;};
Gets a source file by a file name or file path. Returns undefined if none exists.
Parameter fileNameOrPath
File name or path that the path could end with or equal.
Gets a source file by a search function. Returns undefined if none exists.
Parameter searchFunction
Search function.
method getSourceFileOrThrow
getSourceFileOrThrow: { (fileNameOrPath: string): SourceFile; (searchFunction: (file: SourceFile) => boolean): SourceFile;};
Gets a source file by a file name or file path. Throws an error if it doesn't exist.
Parameter fileNameOrPath
File name or path that the path could end with or equal.
Gets a source file by a search function. Throws an error if it doesn't exist.
Parameter searchFunction
Search function.
method getSourceFiles
getSourceFiles: { (): SourceFile[]; (globPattern: string): SourceFile[]; (globPatterns: readonly string[]): SourceFile[];};
Gets all the source files added to the project.
Gets all the source files added to the project that match a pattern.
Parameter globPattern
Glob pattern for filtering out the source files.
Gets all the source files added to the project that match the passed in patterns.
Parameter globPatterns
Glob patterns for filtering out the source files.
method getTypeChecker
getTypeChecker: () => TypeChecker;
Gets the type checker.
method removeSourceFile
removeSourceFile: (sourceFile: SourceFile) => boolean;
Removes a source file from the project.
Parameter sourceFile
Source file to remove.
Returns
True if removed.
method resolveSourceFileDependencies
resolveSourceFileDependencies: () => SourceFile[];
Adds the source files the project's source files depend on to the project.
Returns
The added source files.
Remarks
* This should be done after source files are added to the project, preferably once to avoid doing more work than necessary. * This is done by default when creating a Project and providing a tsconfig.json and not specifying to not add the source files.
method save
save: () => Promise<void>;
Saves all the unsaved source files to the file system and deletes all deleted files.
method saveSync
saveSync: () => void;
Synchronously saves all the unsaved source files to the file system and deletes all deleted files.
Remarks: This might be very slow compared to the asynchronous version if there are a lot of files.
class PropertyAccessExpression
class PropertyAccessExpression< T extends ts.PropertyAccessExpression = ts.PropertyAccessExpression> extends PropertyAccessExpressionBase<T> {}
class PropertyAssignment
class PropertyAssignment extends PropertyAssignmentBase<ts.PropertyAssignment> {}
method getParent
getParent: () => NodeParentType<ts.PropertyAssignment>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.PropertyAssignment>>;
*
method getStructure
getStructure: () => PropertyAssignmentStructure;
Gets the structure equivalent to this node.
method removeInitializer
removeInitializer: () => ShorthandPropertyAssignment;
Removes the initializer and returns the new shorthand property assignment.
Note: The current node will no longer be valid because it's no longer a property assignment.
method set
set: ( structure: Partial<PropertyAssignmentStructure>) => this | ShorthandPropertyAssignment;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setInitializer
setInitializer: (textOrWriterFunction: string | WriterFunction) => this;
Sets the initializer.
Parameter textOrWriterFunction
New text ot set for the initializer.
class PropertyDeclaration
class PropertyDeclaration extends PropertyDeclarationBase<ts.PropertyDeclaration> {}
method getParent
getParent: () => NodeParentType<ts.PropertyDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.PropertyDeclaration>>;
*
method getStructure
getStructure: () => PropertyDeclarationStructure;
Gets the structure equivalent to this node.
method hasAccessorKeyword
hasAccessorKeyword: () => boolean;
Gets if this property declaration has an accessor keyword.
method remove
remove: () => void;
Removes the property.
method set
set: (structure: Partial<PropertyDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setHasAccessorKeyword
setHasAccessorKeyword: (value: boolean) => this;
Sets if this property declaration should have an accessor keyword.
class PropertySignature
class PropertySignature extends PropertySignatureBase<ts.PropertySignature> {}
method getParent
getParent: () => NodeParentType<ts.PropertySignature>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.PropertySignature>>;
*
method getStructure
getStructure: () => PropertySignatureStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<PropertySignatureStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class QualifiedName
class QualifiedName extends Node<ts.QualifiedName> {}
method getLeft
getLeft: () => EntityName;
Gets the left side of the qualified name.
method getParent
getParent: () => NodeParentType<ts.QualifiedName>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.QualifiedName>>;
*
method getRight
getRight: () => Identifier;
Gets the right identifier of the qualified name.
class RefactorEditInfo
class RefactorEditInfo {}
Set of edits to make in response to a refactor action, plus an optional location where renaming should be invoked from.
property compilerObject
readonly compilerObject: ts.RefactorEditInfo;
Gets the compiler refactor edit info.
method applyChanges
applyChanges: (options?: ApplyFileTextChangesOptions) => this;
Executes the combined code actions.
WARNING: This will cause all nodes to be forgotten in the changed files. - Options used when applying the changes.
method getEdits
getEdits: () => FileTextChanges[];
Gets refactor file text changes
method getRenameFilePath
getRenameFilePath: () => string | undefined;
Gets the file path for a rename refactor.
method getRenameLocation
getRenameLocation: () => number | undefined;
Location where renaming should be invoked from.
class ReferencedSymbol
class ReferencedSymbol {}
Referenced symbol.
property compilerObject
readonly compilerObject: ts.ReferencedSymbol;
Gets the compiler referenced symbol.
method getDefinition
getDefinition: () => ReferencedSymbolDefinitionInfo;
Gets the definition.
method getReferences
getReferences: () => ReferencedSymbolEntry[];
Gets the references.
class ReferencedSymbolDefinitionInfo
class ReferencedSymbolDefinitionInfo extends DefinitionInfo<ts.ReferencedSymbolDefinitionInfo> {}
method getDisplayParts
getDisplayParts: () => SymbolDisplayPart[];
Gets the display parts.
class ReferencedSymbolEntry
class ReferencedSymbolEntry extends ReferenceEntry<ts.ReferencedSymbolEntry> {}
method isDefinition
isDefinition: () => boolean | undefined;
If this is the definition reference.
class ReferenceEntry
class ReferenceEntry< T extends ts.ReferenceEntry = ts.ReferenceEntry> extends DocumentSpan<T> {}
constructor
protected constructor();
method isInString
isInString: () => true | undefined;
method isWriteAccess
isWriteAccess: () => boolean;
class RegularExpressionLiteral
class RegularExpressionLiteral extends RegularExpressionLiteralBase<ts.RegularExpressionLiteral> {}
method getLiteralValue
getLiteralValue: () => RegExp;
Gets the literal value.
method getParent
getParent: () => NodeParentType<ts.RegularExpressionLiteral>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.RegularExpressionLiteral>>;
*
method setLiteralValue
setLiteralValue: { (pattern: string, flags?: string): this; (regExp: RegExp): this;};
Sets the literal value according to a pattern and some flags.
Parameter pattern
Pattern.
Parameter flags
Flags.
Sets the literal value according to a regular expression object.
Parameter regExp
Regular expression.
class RenameLocation
class RenameLocation extends DocumentSpan<ts.RenameLocation> {}
Rename location.
method getPrefixText
getPrefixText: () => string | undefined;
Gets the text to insert before the rename.
method getSuffixText
getSuffixText: () => string | undefined;
Gets the text to insert after the rename.
class RestTypeNode
class RestTypeNode extends TypeNode<ts.RestTypeNode> {}
method getParent
getParent: () => NodeParentType<ts.RestTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.RestTypeNode>>;
*
method getTypeNode
getTypeNode: () => TypeNode<ts.TypeNode>;
Gets the rest type node's inner type.
class ReturnStatement
class ReturnStatement extends ReturnStatementBase<ts.ReturnStatement> {}
method getParent
getParent: () => NodeParentType<ts.ReturnStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ReturnStatement>>;
*
class SatisfiesExpression
class SatisfiesExpression extends SatisfiesExpressionBase<ts.SatisfiesExpression> {}
method getParent
getParent: () => NodeParentType<ts.SatisfiesExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SatisfiesExpression>>;
*
class SetAccessorDeclaration
class SetAccessorDeclaration extends SetAccessorDeclarationBase<ts.SetAccessorDeclaration> {}
method getGetAccessor
getGetAccessor: () => GetAccessorDeclaration | undefined;
Gets the corresponding get accessor if one exists.
method getGetAccessorOrThrow
getGetAccessorOrThrow: ( message?: string | (() => string)) => GetAccessorDeclaration;
Gets the corresponding get accessor or throws if not exists.
method getParent
getParent: () => NodeParentType<ts.SetAccessorDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SetAccessorDeclaration>>;
*
method getStructure
getStructure: () => SetAccessorDeclarationStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<SetAccessorDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class SettingsContainer
abstract class SettingsContainer<T extends object> {}
constructor
constructor(defaultSettings: {});
Constructor.
Parameter defaultSettings
The settings to use by default.
method get
get: () => T;
Gets a copy of the settings as an object.
method onModified
onModified: (action: () => void) => void;
Subscribe to modifications in the settings container.
Parameter action
Action to execute when the settings change.
method reset
reset: () => void;
Resets the settings to the default.
method set
set: (settings: Partial<T>) => void;
Sets one or all of the settings.
Parameter settings
Settings to set.
class ShorthandPropertyAssignment
class ShorthandPropertyAssignment extends ShorthandPropertyAssignmentBase<ts.ShorthandPropertyAssignment> {}
method getEqualsToken
getEqualsToken: () => Node<ts.EqualsToken> | undefined;
Gets the equals token if it exists.
method getEqualsTokenOrThrow
getEqualsTokenOrThrow: ( message?: string | (() => string)) => Node<ts.EqualsToken>;
Gets the equals token or throws if it doesn't exist.
method getObjectAssignmentInitializer
getObjectAssignmentInitializer: () => Expression | undefined;
Gets the object assignment initializer if it exists.
method getObjectAssignmentInitializerOrThrow
getObjectAssignmentInitializerOrThrow: ( message?: string | (() => string)) => Expression<ts.Expression>;
Gets the object assignment initializer or throws if it doesn't exist.
method getParent
getParent: () => NodeParentType<ts.ShorthandPropertyAssignment>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ShorthandPropertyAssignment>>;
*
method getStructure
getStructure: () => ShorthandPropertyAssignmentStructure;
Gets the structure equivalent to this node.
method getValueSymbol
getValueSymbol: () => Symbol | undefined;
Gets the shorthand assignment value symbol of this node if it exists. Convenience API for TypeChecker#getShorthandAssignmentValueSymbol(node)
method getValueSymbolOrThrow
getValueSymbolOrThrow: (message?: string | (() => string)) => Symbol;
Gets the value symbol or throws if it doesn't exist.
method hasObjectAssignmentInitializer
hasObjectAssignmentInitializer: () => boolean;
Gets if the shorthand property assignment has an object assignment initializer.
method removeObjectAssignmentInitializer
removeObjectAssignmentInitializer: () => this;
Remove the object assignment initializer.
This is only useful to remove bad code.
method set
set: (structure: Partial<ShorthandPropertyAssignmentStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setInitializer
setInitializer: (text: string) => PropertyAssignment;
Sets the initializer.
Note: The current node will no longer be valid because it's no longer a shorthand property assignment.
Parameter text
New text to set for the initializer.
class Signature
class Signature {}
property compilerSignature
readonly compilerSignature: ts.Signature;
Gets the underlying compiler signature.
method getDeclaration
getDeclaration: () => | MethodSignature | MethodDeclaration | ConstructorDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | CallSignatureDeclaration | ConstructSignatureDeclaration | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | FunctionExpression | ArrowFunction | FunctionDeclaration | JSDocFunctionType;
Gets the signature's declaration.
method getDocumentationComments
getDocumentationComments: () => SymbolDisplayPart[];
Get the documentation comments.
method getJsDocTags
getJsDocTags: () => JSDocTagInfo[];
Gets the JS doc tags.
method getParameters
getParameters: () => Symbol[];
Gets the parameters.
method getReturnType
getReturnType: () => Type;
Gets the signature return type.
method getTypeParameters
getTypeParameters: () => TypeParameter[];
Gets the type parameters.
class SourceFile
class SourceFile extends SourceFileBase<ts.SourceFile> {}
method applyTextChanges
applyTextChanges: ( textChanges: ReadonlyArray<ts.TextChange | TextChange>) => this;
Applies the text changes to the source file.
WARNING! This will forget all the nodes in the file! It's best to do this after you're all done with the file.
Parameter textChanges
Text changes.
method copy
copy: (filePath: string, options?: SourceFileCopyOptions) => SourceFile;
Copy this source file to a new file.
This will modify the module specifiers in the new file, if necessary.
Parameter filePath
New file path. Can be relative to the original file or an absolute path.
Parameter options
Options for copying.
method copyImmediately
copyImmediately: ( filePath: string, options?: SourceFileCopyOptions) => Promise<SourceFile>;
Copy this source file to a new file and immediately saves it to the file system asynchronously.
This will modify the module specifiers in the new file, if necessary.
Parameter filePath
New file path. Can be relative to the original file or an absolute path.
Parameter options
Options for copying.
method copyImmediatelySync
copyImmediatelySync: ( filePath: string, options?: SourceFileCopyOptions) => SourceFile;
Copy this source file to a new file and immediately saves it to the file system synchronously.
This will modify the module specifiers in the new file, if necessary.
Parameter filePath
New file path. Can be relative to the original file or an absolute path.
Parameter options
Options for copying.
method copyToDirectory
copyToDirectory: ( dirPathOrDirectory: string | Directory, options?: SourceFileCopyOptions) => SourceFile;
Copies this source file to the specified directory.
This will modify the module specifiers in the new file, if necessary.
Parameter dirPathOrDirectory
Directory path or directory object to copy the file to.
Parameter options
Options for copying.
Returns
The source file the copy was made to.
method delete
delete: () => void;
Queues a deletion of the file to the file system.
The file will be deleted when you call ast.save(). If you wish to immediately delete the file, then use deleteImmediately().
method deleteImmediately
deleteImmediately: () => Promise<void>;
Asynchronously deletes the file from the file system.
method deleteImmediatelySync
deleteImmediatelySync: () => void;
Synchronously deletes the file from the file system.
method emit
emit: (options?: SourceFileEmitOptions) => Promise<EmitResult>;
Asynchronously emits the source file as a JavaScript file.
method emitSync
emitSync: (options?: SourceFileEmitOptions) => EmitResult;
Synchronously emits the source file as a JavaScript file.
method fixMissingImports
fixMissingImports: ( formatSettings?: FormatCodeSettings, userPreferences?: UserPreferences) => this;
Code fix to add import declarations for identifiers that are referenced, but not imported in the source file.
Parameter formatSettings
Format code settings.
Parameter userPreferences
User preferences for refactoring.
method fixUnusedIdentifiers
fixUnusedIdentifiers: ( formatSettings?: FormatCodeSettings, userPreferences?: UserPreferences) => this;
Removes all unused declarations like interfaces, classes, enums, functions, variables, parameters, methods, properties, imports, etc. from this file.
Tip: For optimal results, sometimes this method needs to be called more than once. There could be nodes that are only referenced in unused declarations and in this case, another call will also remove them.
WARNING! This will forget all the nodes in the file! It's best to do this after you're all done with the file.
Parameter formatSettings
Format code settings.
Parameter userPreferences
User preferences for refactoring.
method formatText
formatText: (settings?: FormatCodeSettings) => void;
Formats the source file text using the internal TypeScript formatting API.
Parameter settings
Format code settings.
method getBaseName
getBaseName: () => string;
Gets the file path's base name.
method getBaseNameWithoutExtension
getBaseNameWithoutExtension: () => string;
Gets the file path's base name without the extension.
method getDirectory
getDirectory: () => Directory;
Gets the directory that the source file is contained in.
method getDirectoryPath
getDirectoryPath: () => StandardizedFilePath;
Gets the directory path that the source file is contained in.
method getEmitOutput
getEmitOutput: (options?: { emitOnlyDtsFiles?: boolean }) => EmitOutput;
Gets the emit output of this source file.
Parameter options
Emit options.
method getExtension
getExtension: () => string;
Gets the file path's extension.
method getFilePath
getFilePath: () => StandardizedFilePath;
Gets the file path.
method getFullText
getFullText: () => string;
Gets the full text with leading trivia.
method getImportStringLiterals
getImportStringLiterals: () => StringLiteral[];
Gets all the descendant string literals that reference a module.
method getLanguageVariant
getLanguageVariant: () => LanguageVariant;
Gets the language variant of the source file.
method getLanguageVersion
getLanguageVersion: () => ScriptTarget;
Gets the script target of the source file.
method getLengthFromLineStartAtPos
getLengthFromLineStartAtPos: (pos: number) => number;
Gets the character count from the start of the line to the provided position.
Parameter pos
Position.
method getLibReferenceDirectives
getLibReferenceDirectives: () => FileReference[];
Gets any
/// <reference lib="..." />
comments.
method getLineAndColumnAtPos
getLineAndColumnAtPos: (pos: number) => { line: number; column: number };
Gets the line and column number at the provided position (1-indexed).
Parameter pos
Position in the source file.
method getLiteralsReferencingOtherSourceFiles
getLiteralsReferencingOtherSourceFiles: () => StringLiteral[];
Gets the string literals in this source file that references other source files.
Remarks
This is similar to
getImportStringLiterals()
, butgetImportStringLiterals()
will return import string literals that may not be referencing another source file or have not been able to be resolved.
method getNodesReferencingOtherSourceFiles
getNodesReferencingOtherSourceFiles: () => SourceFileReferencingNodes[];
Gets the nodes that reference other source files in string literals.
method getParent
getParent: () => NodeParentType<ts.SourceFile>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SourceFile>>;
*
method getPathReferenceDirectives
getPathReferenceDirectives: () => FileReference[];
Gets any
/// <reference path="..." />
comments.
method getPreEmitDiagnostics
getPreEmitDiagnostics: () => Diagnostic[];
Gets the pre-emit diagnostics of the specified source file.
method getReferencedSourceFiles
getReferencedSourceFiles: () => SourceFile[];
Gets the source files this source file references in string literals.
method getReferencingLiteralsInOtherSourceFiles
getReferencingLiteralsInOtherSourceFiles: () => StringLiteral[];
Gets the string literals in other source files that reference this source file.
method getReferencingNodesInOtherSourceFiles
getReferencingNodesInOtherSourceFiles: () => SourceFileReferencingNodes[];
Gets the import and exports in other source files that reference this source file.
method getReferencingSourceFiles
getReferencingSourceFiles: () => SourceFile[];
Gets any source files that reference this source file.
method getRelativePathAsModuleSpecifierTo
getRelativePathAsModuleSpecifierTo: { (filePath: string): string; (sourceFile: SourceFile): string; (directory: Directory): string;};
Gets the relative path to the specified file path as a module specifier.
Parameter filePath
File path.
Remarks
To get to a directory, provide
path/to/directory/index.ts
.Gets the relative path to the specified source file as a module specifier.
Parameter sourceFile
Source file.
Gets the relative path to the specified directory as a module specifier.
Parameter directory
Directory.
method getRelativePathTo
getRelativePathTo: { (fileOrDirPath: string): string; (sourceFile: SourceFile): string; (directory: Directory): string;};
Gets the relative path to the specified path.
Parameter fileOrDirPath
The file or directory path.
Gets the relative path to another source file.
Parameter sourceFile
Source file.
Gets the relative path to another directory.
Parameter directory
Directory.
method getScriptKind
getScriptKind: () => ScriptKind;
Gets the script kind of the source file.
method getStructure
getStructure: () => SourceFileStructure;
Gets the structure equivalent to this node.
method getTypeReferenceDirectives
getTypeReferenceDirectives: () => FileReference[];
Gets any
/// <reference types="..." />
comments.
method indent
indent: { (pos: number, times?: number): this; (positionRange: [number, number], times?: number): this;};
Indents the line at the specified position.
Parameter pos
Position.
Parameter times
Times to indent. Specify a negative value to unindent.
Indents the lines within the specified range.
Parameter positionRange
Position range.
Parameter times
Times to indent. Specify a negative value to unindent.
method isDeclarationFile
isDeclarationFile: () => boolean;
Gets if this is a declaration file.
method isFromExternalLibrary
isFromExternalLibrary: () => boolean;
Gets if the source file was discovered while loading an external library.
method isInNodeModules
isInNodeModules: () => boolean;
Gets if the source file is a descendant of a node_modules directory.
method isSaved
isSaved: () => boolean;
Gets if this source file has been saved or if the latest changes have been saved.
method move
move: (filePath: string, options?: SourceFileMoveOptions) => SourceFile;
Moves this source file to a new file.
This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
Parameter filePath
New file path. Can be relative to the original file or an absolute path.
Parameter options
Options for moving.
method moveImmediately
moveImmediately: ( filePath: string, options?: SourceFileMoveOptions) => Promise<SourceFile>;
Moves this source file to a new file and asynchronously updates the file system immediately.
This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
Parameter filePath
New file path. Can be relative to the original file or an absolute path.
Parameter options
Options for moving.
method moveImmediatelySync
moveImmediatelySync: ( filePath: string, options?: SourceFileMoveOptions) => SourceFile;
Moves this source file to a new file and synchronously updates the file system immediately.
This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
Parameter filePath
New file path. Can be relative to the original file or an absolute path.
Parameter options
Options for moving.
method moveToDirectory
moveToDirectory: ( dirPathOrDirectory: string | Directory, options?: SourceFileMoveOptions) => SourceFile;
Moves this source file to the specified directory.
This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
Parameter dirPathOrDirectory
Directory path or directory object to move the file to.
Parameter options
Options for moving.
method onModified
onModified: ( subscription: (sender: SourceFile) => void, subscribe?: boolean) => this;
Subscribe to when the source file is modified.
Parameter subscription
Subscription.
Parameter subscribe
Optional and defaults to true. Use an explicit false to unsubscribe.
method organizeImports
organizeImports: ( formatSettings?: FormatCodeSettings, userPreferences?: UserPreferences) => this;
Organizes the imports in the file.
WARNING! This will forget all the nodes in the file! It's best to do this after you're all done with the file.
Parameter formatSettings
Format code settings.
Parameter userPreferences
User preferences for refactoring.
method refreshFromFileSystem
refreshFromFileSystem: () => Promise<FileSystemRefreshResult>;
Refresh the source file from the file system.
WARNING: When updating from the file system, this will "forget" any previously navigated nodes.
Returns
What action ended up taking place.
method refreshFromFileSystemSync
refreshFromFileSystemSync: () => FileSystemRefreshResult;
Synchronously refreshes the source file from the file system.
WARNING: When updating from the file system, this will "forget" any previously navigated nodes.
Returns
What action ended up taking place.
method save
save: () => Promise<void>;
Asynchronously saves this file with any changes.
method saveSync
saveSync: () => void;
Synchronously saves this file with any changes.
method set
set: (structure: Partial<SourceFileStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method unindent
unindent: { (pos: number, times?: number): this; (positionRange: [number, number], times?: number): this;};
Deindents the line at the specified position.
Parameter pos
Position.
Parameter times
Times to unindent. Specify a negative value to indent.
Deindents the lines within the specified range.
Parameter positionRange
Position range.
Parameter times
Times to unindent. Specify a negative value to indent.
class SpreadAssignment
class SpreadAssignment extends SpreadAssignmentBase<ts.SpreadAssignment> {}
method getParent
getParent: () => NodeParentType<ts.SpreadAssignment>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SpreadAssignment>>;
*
method getStructure
getStructure: () => SpreadAssignmentStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<SpreadAssignmentStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class SpreadElement
class SpreadElement extends SpreadElementBase<ts.SpreadElement> {}
method getParent
getParent: () => NodeParentType<ts.SpreadElement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SpreadElement>>;
*
class Statement
class Statement<T extends ts.Statement = ts.Statement> extends StatementBase<T> {}
method remove
remove: () => void;
Removes the statement.
class StringLiteral
class StringLiteral extends StringLiteralBase<ts.StringLiteral> {}
method getLiteralValue
getLiteralValue: () => string;
Gets the literal value.
This is equivalent to .getLiteralText() for string literals and only exists for consistency with other literals.
method getParent
getParent: () => NodeParentType<ts.StringLiteral>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.StringLiteral>>;
*
method getQuoteKind
getQuoteKind: () => QuoteKind;
Gets the quote kind.
method setLiteralValue
setLiteralValue: (value: string) => this;
Sets the literal value.
Parameter value
Value to set.
class SuperElementAccessExpression
class SuperElementAccessExpression extends SuperElementAccessExpressionBase<ts.SuperElementAccessExpression> {}
method getParent
getParent: () => NodeParentType<ts.SuperElementAccessExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SuperElementAccessExpression>>;
*
class SuperExpression
class SuperExpression extends SuperExpressionBase<ts.SuperExpression> {}
method getParent
getParent: () => NodeParentType<ts.SuperExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SuperExpression>>;
*
class SuperPropertyAccessExpression
class SuperPropertyAccessExpression extends SuperPropertyAccessExpressionBase<ts.SuperPropertyAccessExpression> {}
method getParent
getParent: () => NodeParentType<ts.SuperPropertyAccessExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SuperPropertyAccessExpression>>;
*
class SwitchStatement
class SwitchStatement extends SwitchStatementBase<ts.SwitchStatement> {}
method getCaseBlock
getCaseBlock: () => CaseBlock;
Gets this switch statement's case block.
method getClauses
getClauses: () => CaseOrDefaultClause[];
Gets the switch statement's case block's clauses.
method getParent
getParent: () => NodeParentType<ts.SwitchStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SwitchStatement>>;
*
method removeClause
removeClause: (index: number) => CaseBlock;
Removes the specified clause based on the provided index.
Parameter index
Index.
method removeClauses
removeClauses: (indexRange: [number, number]) => CaseBlock;
Removes the specified clauses based on the provided index range.
Parameter indexRange
Index range.
class Symbol
class Symbol {}
property compilerSymbol
readonly compilerSymbol: ts.Symbol;
Gets the underlying compiler symbol.
method getAliasedSymbol
getAliasedSymbol: () => Symbol | undefined;
Gets the aliased symbol or returns undefined if it doesn't exist.
method getAliasedSymbolOrThrow
getAliasedSymbolOrThrow: (message?: string | (() => string)) => Symbol;
Gets the aliased symbol or throws if it doesn't exist.
method getDeclarations
getDeclarations: () => Node[];
Gets the symbol declarations.
method getDeclaredType
getDeclaredType: () => Type;
Gets the declared type of the symbol.
method getEscapedName
getEscapedName: () => string;
Gets the escaped name.
method getExport
getExport: (name: string) => Symbol | undefined;
Gets the export of the symbol by the specified name or returns undefined if not exists.
Parameter name
Name of the export.
method getExportOrThrow
getExportOrThrow: (name: string, message?: string | (() => string)) => Symbol;
Gets the export of the symbol by the specified name or throws if not exists.
Parameter name
Name of the export.
method getExports
getExports: () => Symbol[];
Gets the exports from the symbol.
method getExportSymbol
getExportSymbol: () => Symbol;
Gets the export symbol of the symbol if its a local symbol with a corresponding export symbol. Otherwise returns the current symbol.
The following is from the compiler API documentation:
For example, at
export type T = number;
: -getSymbolAtLocation
at the locationT
will return the exported symbol forT
. - But the result ofgetSymbolsInScope
will contain the *local* symbol forT
, not the exported symbol. - CallinggetExportSymbol
on that local symbol will return the exported symbol.
method getFlags
getFlags: () => SymbolFlags;
Gets the symbol flags.
method getFullyQualifiedName
getFullyQualifiedName: () => string;
Gets the fully qualified name.
method getGlobalExport
getGlobalExport: (name: string) => Symbol | undefined;
Gets the global export of the symbol by the specified name or returns undefined if not exists.
Parameter name
Name of the global export.
method getGlobalExportOrThrow
getGlobalExportOrThrow: ( name: string, message?: string | (() => string)) => Symbol;
Gets the global export of the symbol by the specified name or throws if not exists.
Parameter name
Name of the global export.
method getGlobalExports
getGlobalExports: () => Symbol[];
Gets the global exports from the symbol.
method getImmediatelyAliasedSymbol
getImmediatelyAliasedSymbol: () => Symbol | undefined;
Follows a single alias to get the immediately aliased symbol or returns undefined if it doesn't exist.
method getImmediatelyAliasedSymbolOrThrow
getImmediatelyAliasedSymbolOrThrow: ( message?: string | (() => string)) => Symbol;
Follows a single alias to get the immediately aliased symbol or throws if it doesn't exist.
method getJsDocTags
getJsDocTags: () => JSDocTagInfo[];
Gets the JS doc tag infos of the symbol.
method getMember
getMember: (name: string) => Symbol | undefined;
Gets the member of the symbol by the specified name or returns undefined if not exists.
Parameter name
Name of the member.
method getMemberOrThrow
getMemberOrThrow: (name: string, message?: string | (() => string)) => Symbol;
Gets the member of the symbol by the specified name or throws if not exists.
Parameter name
Name of the export.
method getMembers
getMembers: () => Symbol[];
Gets the members of the symbol
method getName
getName: () => string;
Gets the symbol name.
method getTypeAtLocation
getTypeAtLocation: (node: Node) => Type<ts.Type>;
Gets the type of the symbol at a location.
Parameter node
Location to get the type at for this symbol.
method getValueDeclaration
getValueDeclaration: () => Node | undefined;
Gets the value declaration of the symbol or returns undefined if it doesn't exist.
method getValueDeclarationOrThrow
getValueDeclarationOrThrow: (message?: string | (() => string)) => Node;
Gets the value declaration of a symbol or throws if it doesn't exist.
method hasFlags
hasFlags: (flags: SymbolFlags) => boolean;
Gets if the symbol has the specified flags.
Parameter flags
Flags to check if the symbol has.
method isAlias
isAlias: () => boolean;
Gets if the symbol is an alias.
method isOptional
isOptional: () => boolean;
Gets if the symbol is optional.
class SymbolDisplayPart
class SymbolDisplayPart {}
Symbol display part.
property compilerObject
readonly compilerObject: ts.SymbolDisplayPart;
Gets the compiler symbol display part.
method getKind
getKind: () => string;
Gets the kind.
Examples: "text", "lineBreak"
method getText
getText: () => string;
Gets the text.
class SyntaxList
class SyntaxList extends Node<ts.SyntaxList> {}
method addChildText
addChildText: ( textOrWriterFunction: | string | WriterFunction | ReadonlyArray<string | WriterFunction>) => Node<ts.Node>[];
Adds text at the end of the current children.
Parameter textOrWriterFunction
Text to add or function that provides a writer to write with.
Returns
The children that were added.
method getParent
getParent: () => NodeParentType<ts.SyntaxList>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.SyntaxList>>;
*
method insertChildText
insertChildText: ( index: number, textOrWriterFunction: | string | WriterFunction | ReadonlyArray<string | WriterFunction>) => Node<ts.Node>[];
Inserts text at the specified child index.
Parameter index
Child index to insert at.
Parameter textOrWriterFunction
Text to insert or function that provides a writer to write with.
Returns
The children that were inserted.
class TaggedTemplateExpression
class TaggedTemplateExpression extends MemberExpression<ts.TaggedTemplateExpression> {}
method getParent
getParent: () => NodeParentType<ts.TaggedTemplateExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TaggedTemplateExpression>>;
*
method getTag
getTag: () => LeftHandSideExpression;
Gets the tag.
method getTemplate
getTemplate: () => TemplateLiteral;
Gets the template literal.
method removeTag
removeTag: () => TemplateLiteral;
Removes the tag from the tagged template.
Returns
The new template expression.
class TemplateExpression
class TemplateExpression extends TemplateExpressionBase<ts.TemplateExpression> {}
method getHead
getHead: () => TemplateHead;
Gets the template head.
method getParent
getParent: () => NodeParentType<ts.TemplateExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TemplateExpression>>;
*
method getTemplateSpans
getTemplateSpans: () => TemplateSpan[];
Gets the template spans.
method setLiteralValue
setLiteralValue: (value: string) => Node<ts.Node>;
Sets the literal value.
Note: This could possibly replace the node if you remove all the tagged templates.
Parameter value
Value to set.
Returns
The new node if the kind changed; the current node otherwise.
class TemplateHead
class TemplateHead extends TemplateHeadBase<ts.TemplateHead> {}
method getParent
getParent: () => NodeParentType<ts.TemplateHead>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TemplateHead>>;
*
class TemplateLiteralTypeNode
class TemplateLiteralTypeNode extends TypeNode<ts.TemplateLiteralTypeNode> {}
method getHead
getHead: () => TemplateHead;
Gets the template head.
method getParent
getParent: () => NodeParentType<ts.TemplateLiteralTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TemplateLiteralTypeNode>>;
*
method getTemplateSpans
getTemplateSpans: () => TypeNode<ts.TypeNode>[];
Gets the template spans.
method setLiteralValue
setLiteralValue: (value: string) => Node<ts.Node>;
Sets the literal value.
Note: This could possibly replace the node if you remove all the tagged templates.
Parameter value
Value to set.
Returns
The new node if the kind changed; the current node otherwise.
class TemplateMiddle
class TemplateMiddle extends TemplateMiddleBase<ts.TemplateMiddle> {}
method getParent
getParent: () => NodeParentType<ts.TemplateMiddle>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TemplateMiddle>>;
*
class TemplateSpan
class TemplateSpan extends TemplateSpanBase<ts.TemplateSpan> {}
method getLiteral
getLiteral: () => TemplateMiddle | TemplateTail;
Gets the template literal.
method getParent
getParent: () => NodeParentType<ts.TemplateSpan>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TemplateSpan>>;
*
class TemplateTail
class TemplateTail extends TemplateTailBase<ts.TemplateTail> {}
method getParent
getParent: () => NodeParentType<ts.TemplateTail>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TemplateTail>>;
*
class TextChange
class TextChange {}
Represents a text change.
property compilerObject
readonly compilerObject: ts.TextChange;
Gets the compiler text change.
method getNewText
getNewText: () => string;
Gets the new text.
method getSpan
getSpan: () => TextSpan;
Gets the text span.
class TextRange
class TextRange<TRange extends ts.TextRange = ts.TextRange> {}
constructor
protected constructor();
property compilerObject
readonly compilerObject: ts.TextRange;
Gets the underlying compiler object.
method getEnd
getEnd: () => number;
Gets the end.
method getPos
getPos: () => number;
Gets the position.
method getSourceFile
getSourceFile: () => SourceFile;
Gets the source file of the text range.
method getText
getText: () => string;
Gets the text of the text range.
method getWidth
getWidth: () => number;
Gets the width of the text range.
method wasForgotten
wasForgotten: () => boolean;
Gets if the text range was forgotten.
This will be true after any manipulations have occured to the source file this text range was generated from.
class TextSpan
class TextSpan {}
Represents a span of text.
property compilerObject
readonly compilerObject: ts.TextSpan;
Gets the compiler text span.
method getEnd
getEnd: () => number;
Gets the start + length.
method getLength
getLength: () => number;
Gets the length.
method getStart
getStart: () => number;
Gets the start.
class ThisExpression
class ThisExpression extends ThisExpressionBase<ts.ThisExpression> {}
method getParent
getParent: () => NodeParentType<ts.ThisExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ThisExpression>>;
*
class ThisTypeNode
class ThisTypeNode extends TypeNode<ts.ThisTypeNode> {}
method getParent
getParent: () => NodeParentType<ts.ThisTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ThisTypeNode>>;
*
class ThrowStatement
class ThrowStatement extends ThrowStatementBase<ts.ThrowStatement> {}
method getParent
getParent: () => NodeParentType<ts.ThrowStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.ThrowStatement>>;
*
class TrueLiteral
class TrueLiteral extends TrueLiteralBase<ts.TrueLiteral> {}
method getLiteralValue
getLiteralValue: () => boolean;
Gets the literal value.
method getParent
getParent: () => NodeParentType<ts.TrueLiteral>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TrueLiteral>>;
*
method setLiteralValue
setLiteralValue: (value: boolean) => this | FalseLiteral;
Sets the literal value.
Note: This forgets the current node and returns the new node if the value changes.
Parameter value
Value to set.
class TryStatement
class TryStatement extends TryStatementBase<ts.TryStatement> {}
method getCatchClause
getCatchClause: () => CatchClause | undefined;
Gets this try statement's catch clause or undefined if none exists.
method getCatchClauseOrThrow
getCatchClauseOrThrow: (message?: string | (() => string)) => CatchClause;
Gets this try statement's catch clause or throws if none exists.
method getFinallyBlock
getFinallyBlock: () => Block | undefined;
Gets this try statement's finally block or undefined if none exists.
method getFinallyBlockOrThrow
getFinallyBlockOrThrow: (message?: string | (() => string)) => Block;
Gets this try statement's finally block or throws if none exists.
method getParent
getParent: () => NodeParentType<ts.TryStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TryStatement>>;
*
method getTryBlock
getTryBlock: () => Block;
Gets this try statement's try block.
class TupleTypeNode
class TupleTypeNode extends TypeNode<ts.TupleTypeNode> {}
method getElements
getElements: () => (TypeNode<ts.TypeNode> | NamedTupleMember)[];
Gets the tuple element type nodes.
method getParent
getParent: () => NodeParentType<ts.TupleTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TupleTypeNode>>;
*
class Type
class Type<TType extends ts.Type = ts.Type> {}
constructor
protected constructor();
property compilerType
readonly compilerType: ts.Type;
Gets the underlying compiler type.
method getAliasSymbol
getAliasSymbol: () => Symbol | undefined;
Gets the alias symbol if it exists.
method getAliasSymbolOrThrow
getAliasSymbolOrThrow: (message?: string | (() => string)) => Symbol;
Gets the alias symbol if it exists, or throws.
method getAliasTypeArguments
getAliasTypeArguments: () => Type[];
Gets the alias type arguments.
method getApparentProperties
getApparentProperties: () => Symbol[];
Gets the apparent properties of the type.
method getApparentProperty
getApparentProperty: { (name: string): Symbol | undefined; (findFunction: (declaration: Symbol) => boolean): Symbol;};
Gets an apparent property.
Parameter name
By a name.
Parameter findFunction
Function for searching for an apparent property.
method getApparentType
getApparentType: () => Type;
Gets the apparent type.
method getArrayElementType
getArrayElementType: () => Type<ts.Type> | undefined;
Gets the array element type or returns undefined if it doesn't exist (ex. for
T[]
it would beT
).
method getArrayElementTypeOrThrow
getArrayElementTypeOrThrow: (message?: string | (() => string)) => Type<ts.Type>;
Gets the array element type or throws if it doesn't exist (ex. for
T[]
it would beT
).
method getBaseTypeOfLiteralType
getBaseTypeOfLiteralType: () => Type<ts.Type>;
Gets the base type of a literal type.
For example, for a number literal type it will return the number type.
method getBaseTypes
getBaseTypes: () => Type<ts.BaseType>[];
Gets the base types.
method getCallSignatures
getCallSignatures: () => Signature[];
Gets the call signatures.
method getConstraint
getConstraint: () => Type<ts.Type> | undefined;
Gets the constraint or returns undefined if it doesn't exist.
method getConstraintOrThrow
getConstraintOrThrow: (message?: string | (() => string)) => Type<ts.Type>;
Gets the constraint or throws if it doesn't exist.
method getConstructSignatures
getConstructSignatures: () => Signature[];
Gets the construct signatures.
method getDefault
getDefault: () => Type<ts.Type> | undefined;
Gets the default type or returns undefined if it doesn't exist.
method getDefaultOrThrow
getDefaultOrThrow: (message?: string | (() => string)) => Type<ts.Type>;
Gets the default type or throws if it doesn't exist.
method getFlags
getFlags: () => TypeFlags;
Gets the type flags.
method getIntersectionTypes
getIntersectionTypes: () => Type[];
Gets the intersection types (ex. for
T & U
it returns the array[T, U]
).
method getLiteralFreshType
getLiteralFreshType: () => Type<ts.FreshableType> | undefined;
Gets the fresh type of the literal or returns undefined if this is not a literal type.
Note: I have no idea what this means. Please help contribute to these js docs if you know.
method getLiteralFreshTypeOrThrow
getLiteralFreshTypeOrThrow: ( message?: string | (() => string)) => Type<ts.FreshableType>;
Gets the fresh type of the literal or throws if this is not a literal type.
Note: I have no idea what this means. Please help contribute to these js docs if you know.
method getLiteralRegularType
getLiteralRegularType: () => Type<ts.FreshableType> | undefined;
Gets the regular type of the literal or returns undefined if this is not a literal type.
Note: I have no idea what this means. Please help contribute to these js docs if you know.
method getLiteralRegularTypeOrThrow
getLiteralRegularTypeOrThrow: ( message?: string | (() => string)) => Type<ts.FreshableType>;
Gets the regular type of the literal or throws if this is not a literal type.
Note: I have no idea what this means. Please help contribute to these js docs if you know.
method getLiteralValue
getLiteralValue: () => string | number | ts.PseudoBigInt | undefined;
Gets the value of a literal or returns undefined if this is not a literal type.
method getLiteralValueOrThrow
getLiteralValueOrThrow: ( message?: string | (() => string)) => string | number | ts.PseudoBigInt;
Gets the value of the literal or throws if this is not a literal type.
method getNonNullableType
getNonNullableType: () => Type;
Gets the non-nullable type.
method getNumberIndexType
getNumberIndexType: () => Type | undefined;
Gets the number index type.
method getObjectFlags
getObjectFlags: () => | 0 | ObjectFlags.Class | ObjectFlags.Interface | ObjectFlags.Reference | ObjectFlags.Tuple | ObjectFlags.Anonymous | ObjectFlags.Mapped | ObjectFlags.Instantiated | ObjectFlags.ObjectLiteral | ObjectFlags.EvolvingArray | ObjectFlags.ObjectLiteralPatternWithComputedProperties | ObjectFlags.ReverseMapped | ObjectFlags.JsxAttributes | ObjectFlags.JSLiteral | ObjectFlags.FreshLiteral | ObjectFlags.ArrayLiteral | ObjectFlags.ClassOrInterface | ObjectFlags.ContainsSpread | ObjectFlags.ObjectRestType | ObjectFlags.InstantiationExpressionType | ObjectFlags.SingleSignatureType;
Gets the object flags.
Remarks
Returns 0 for a non-object type.
method getProperties
getProperties: () => Symbol[];
Gets the properties of the type.
method getProperty
getProperty: { (name: string): Symbol | undefined; (findFunction: (declaration: Symbol) => boolean): Symbol;};
Gets a property or returns undefined if it does not exist.
Parameter name
By a name.
Gets a property or returns undefined if it does not exist.
Parameter findFunction
Function for searching for a property.
method getPropertyOrThrow
getPropertyOrThrow: { (name: string): Symbol; (findFunction: (declaration: Symbol) => boolean): Symbol;};
Gets a property or throws if it doesn't exist.
Parameter name
By a name.
Gets a property or throws if it doesn't exist.
Parameter findFunction
Function for searching for a property.
method getStringIndexType
getStringIndexType: () => Type | undefined;
Gets the string index type.
method getSymbol
getSymbol: () => Symbol | undefined;
Gets the symbol of the type.
method getSymbolOrThrow
getSymbolOrThrow: (message?: string | (() => string)) => Symbol;
Gets the symbol of the type or throws.
method getTargetType
getTargetType: () => Type<ts.GenericType> | undefined;
Returns the generic type when the type is a type reference, returns itself when it's already a generic type, or otherwise returns undefined.
For example:
- Given type reference
Promise<string>
returnsPromise<T>
. - Given generic typePromise<T>
returns the samePromise<T>
. - Givenstring
returnsundefined
.
method getTargetTypeOrThrow
getTargetTypeOrThrow: ( message?: string | (() => string)) => Type<ts.GenericType>;
Returns the generic type when the type is a type reference, returns itself when it's already a generic type, or otherwise throws an error.
For example:
- Given type reference
Promise<string>
returnsPromise<T>
. - Given generic typePromise<T>
returns the samePromise<T>
. - Givenstring
throws an error.
method getText
getText: (enclosingNode?: Node, typeFormatFlags?: TypeFormatFlags) => string;
Gets the type text.
Parameter enclosingNode
The enclosing node.
Parameter typeFormatFlags
Format flags for the type text.
method getTupleElements
getTupleElements: () => Type[];
Gets the individual element types of the tuple.
method getTypeArguments
getTypeArguments: () => Type[];
Gets type arguments.
method getUnionTypes
getUnionTypes: () => Type[];
Gets the union types (ex. for
T | U
it returns the array[T, U]
).
method isAnonymous
isAnonymous: () => boolean;
Gets if this is an anonymous type.
method isAny
isAny: () => boolean;
Gets if this is an any type.
method isArray
isArray: () => boolean;
Gets if this is an array type.
method isAssignableTo
isAssignableTo: (target: Type) => boolean;
Gets if the type is assignable to another type.
method isBigInt
isBigInt: () => boolean;
Gets if this is a BigInt.
method isBigIntLiteral
isBigIntLiteral: () => boolean;
Gets if this is a BigInt literal type.
method isBoolean
isBoolean: () => boolean;
Gets if this is a boolean type.
method isBooleanLiteral
isBooleanLiteral: () => boolean;
Gets if this is a boolean literal type.
method isClass
isClass: () => this is Type<ts.InterfaceType>;
Gets if this is a class type.
method isClassOrInterface
isClassOrInterface: () => this is Type<ts.InterfaceType>;
Gets if this is a class or interface type.
method isEnum
isEnum: () => boolean;
Gets if this is an enum type.
method isEnumLiteral
isEnumLiteral: () => boolean;
Gets if this is an enum literal type.
method isInterface
isInterface: () => this is Type<ts.InterfaceType>;
Gets if this is an interface type.
method isIntersection
isIntersection: () => this is Type<ts.IntersectionType>;
Gets if this is an intersection type.
method isLiteral
isLiteral: () => boolean;
Gets if this is a literal type.
method isNever
isNever: () => boolean;
Gets if this is a never type.
method isNull
isNull: () => boolean;
Gets if this is the null type.
method isNullable
isNullable: () => boolean;
Gets if the type is possibly null or undefined.
method isNumber
isNumber: () => boolean;
Gets if this is a number type.
method isNumberLiteral
isNumberLiteral: () => this is Type<ts.NumberLiteralType>;
Gets if this is a number literal type.
method isObject
isObject: () => this is Type<ts.ObjectType>;
Gets if this is an object type.
method isReadonlyArray
isReadonlyArray: () => boolean;
Gets if this is a readonly array type.
method isString
isString: () => boolean;
Gets if this is a string type.
method isStringLiteral
isStringLiteral: () => this is Type<ts.StringLiteralType>;
Gets if this is a string literal type.
method isTemplateLiteral
isTemplateLiteral: () => this is Type<ts.TemplateLiteralType>;
Gets if this is a template literal type.
method isTuple
isTuple: () => this is Type<ts.TupleType>;
Gets if this is a tuple type.
method isTypeParameter
isTypeParameter: () => this is TypeParameter;
Gets if this is a type parameter.
method isUndefined
isUndefined: () => boolean;
Gets if this is the undefined type.
method isUnion
isUnion: () => this is Type<ts.UnionType>;
Gets if this is a union type.
method isUnionOrIntersection
isUnionOrIntersection: () => this is Type<ts.UnionOrIntersectionType>;
Gets if this is a union or intersection type.
method isUnknown
isUnknown: () => boolean;
Gets if this is the unknown type.
method isVoid
isVoid: () => boolean;
Gets if this is the void type.
class TypeAliasDeclaration
class TypeAliasDeclaration extends TypeAliasDeclarationBase<ts.TypeAliasDeclaration> {}
method getParent
getParent: () => NodeParentType<ts.TypeAliasDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TypeAliasDeclaration>>;
*
method getStructure
getStructure: () => TypeAliasDeclarationStructure;
Gets the structure equivalent to this node.
method set
set: (structure: Partial<TypeAliasDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class TypeAssertion
class TypeAssertion extends TypeAssertionBase<ts.TypeAssertion> {}
method getParent
getParent: () => NodeParentType<ts.TypeAssertion>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TypeAssertion>>;
*
class TypeChecker
class TypeChecker {}
Wrapper around the TypeChecker.
property compilerObject
readonly compilerObject: ts.TypeChecker;
Gets the compiler's TypeChecker.
method getAliasedSymbol
getAliasedSymbol: (symbol: Symbol) => Symbol | undefined;
Gets the aliased symbol of a symbol.
Parameter symbol
Symbol to get the alias symbol of.
method getAmbientModules
getAmbientModules: () => Symbol[];
Gets the ambient module symbols (ex. modules in the folder or node_modules).
method getApparentType
getApparentType: (type: Type) => Type<ts.Type>;
Gets the apparent type of a type.
Parameter type
Type to get the apparent type of.
method getBaseTypeOfLiteralType
getBaseTypeOfLiteralType: (type: Type) => Type<ts.Type>;
Gets the base type of a literal type.
For example, for a number literal type it will return the number type.
Parameter type
Literal type to get the base type of.
method getConstantValue
getConstantValue: (node: EnumMember) => string | number | undefined;
Gets the constant value of a declaration.
Parameter node
Node to get the constant value from.
method getContextualType
getContextualType: (expression: Expression) => Type | undefined;
Gets the contextual type of an expression.
Parameter expression
Expression.
method getDeclaredTypeOfSymbol
getDeclaredTypeOfSymbol: (symbol: Symbol) => Type;
Gets the declared type of a symbol.
Parameter symbol
Symbol to get the type for.
method getExportsOfModule
getExportsOfModule: (moduleSymbol: Symbol) => Symbol[];
Gets the exports of a module.
Parameter moduleSymbol
Module symbol.
method getExportSpecifierLocalTargetSymbol
getExportSpecifierLocalTargetSymbol: ( exportSpecifier: ExportSpecifier) => Symbol | undefined;
Gets the local target symbol of the provided export specifier.
Parameter exportSpecifier
Export specifier.
method getExportSymbolOfSymbol
getExportSymbolOfSymbol: (symbol: Symbol) => Symbol;
Gets the export symbol of a local symbol with a corresponding export symbol. Otherwise returns the input symbol.
The following is from the compiler API documentation:
For example, at
export type T = number;
: -getSymbolAtLocation
at the locationT
will return the exported symbol forT
. - But the result ofgetSymbolsInScope
will contain the *local* symbol forT
, not the exported symbol. - CallinggetExportSymbolOfSymbol
on that local symbol will return the exported symbol.
method getFullyQualifiedName
getFullyQualifiedName: (symbol: Symbol) => string;
Gets the fully qualified name of a symbol.
Parameter symbol
Symbol to get the fully qualified name of.
method getImmediatelyAliasedSymbol
getImmediatelyAliasedSymbol: (symbol: Symbol) => Symbol | undefined;
Follow a single alias to get the immediately aliased symbol.
Parameter symbol
Symbol to get the immediate alias symbol of.
method getPropertiesOfType
getPropertiesOfType: (type: Type) => Symbol[];
Gets the properties of a type.
Parameter type
Type.
method getResolvedSignature
getResolvedSignature: (node: CallLikeExpression) => Signature | undefined;
Gets the resolved signature from a node or returns undefined if the signature can't be resolved.
Parameter node
Node to get the signature from.
method getResolvedSignatureOrThrow
getResolvedSignatureOrThrow: ( node: CallLikeExpression, message?: string | (() => string)) => Signature;
Gets the resolved signature from a node or throws if the signature cannot be resolved.
Parameter node
Node to get the signature from.
method getReturnTypeOfSignature
getReturnTypeOfSignature: (signature: Signature) => Type;
Gets the return type of a signature.
Parameter signature
Signature to get the return type of.
method getShorthandAssignmentValueSymbol
getShorthandAssignmentValueSymbol: (node: Node) => Symbol | undefined;
Gets the shorthand assignment value symbol of the provided node.
method getSignatureFromNode
getSignatureFromNode: ( node: Node<ts.SignatureDeclaration>) => Signature | undefined;
Gets a signature from a node.
Parameter node
Node to get the signature from.
method getSymbolAtLocation
getSymbolAtLocation: (node: Node) => Symbol | undefined;
Gets the symbol at the specified location or undefined if none exists.
Parameter node
Node to get the symbol for.
method getSymbolsInScope
getSymbolsInScope: (node: Node, meaning: SymbolFlags) => Symbol[];
Gets the symbols in the scope of the provided node.
Note: This will always return the local symbols. If you want the export symbol from a local symbol, then use the
#getExportSymbolOfSymbol(symbol)
method.Parameter node
Node to check the scope for.
Parameter meaning
Meaning of symbol to filter by.
method getTypeArguments
getTypeArguments: (typeReference: Type) => Type<ts.Type>[];
Gets the type arguments from a type reference.
Parameter typeReference
Type reference.
method getTypeAtLocation
getTypeAtLocation: (node: Node) => Type;
Gets the type at the specified location.
Parameter node
Node to get the type for.
method getTypeOfSymbolAtLocation
getTypeOfSymbolAtLocation: (symbol: Symbol, node: Node) => Type;
Gets the type of a symbol at the specified location.
Parameter symbol
Symbol to get the type for.
Parameter node
Location to get the type for.
method getTypeText
getTypeText: ( type: Type, enclosingNode?: Node, typeFormatFlags?: TypeFormatFlags) => string;
Gets the type text
Parameter type
Type to get the text of.
Parameter enclosingNode
Enclosing node.
Parameter typeFormatFlags
Type format flags.
method isTypeAssignableTo
isTypeAssignableTo: (sourceType: Type, targetType: Type) => boolean;
Checks if a type is assignable to another type.
method resolveName
resolveName: ( name: string, location: Node | undefined, meaning: SymbolFlags, excludeGlobals: boolean) => Symbol | undefined;
class TypeElement
class TypeElement< TNode extends ts.TypeElement = ts.TypeElement> extends Node<TNode> {}
method remove
remove: () => void;
Removes the member.
class TypeLiteralNode
class TypeLiteralNode extends TypeLiteralNodeBase<ts.TypeLiteralNode> {}
method getParent
getParent: () => NodeParentType<ts.TypeLiteralNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TypeLiteralNode>>;
*
class TypeNode
class TypeNode<T extends ts.TypeNode = ts.TypeNode> extends Node<T> {}
class TypeOfExpression
class TypeOfExpression extends TypeOfExpressionBase<ts.TypeOfExpression> {}
method getParent
getParent: () => NodeParentType<ts.TypeOfExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TypeOfExpression>>;
*
class TypeOperatorTypeNode
class TypeOperatorTypeNode extends TypeNode<ts.TypeOperatorNode> {}
method getOperator
getOperator: () => | SyntaxKind.KeyOfKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.UniqueKeyword;
Gets the operator of the type node.
method getParent
getParent: () => NodeParentType<ts.TypeOperatorNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TypeOperatorNode>>;
*
method getTypeNode
getTypeNode: () => TypeNode;
Gets the node within the type operator.
class TypeParameter
class TypeParameter extends Type<ts.TypeParameter> {}
method getConstraint
getConstraint: () => Type | undefined;
Gets the constraint type.
method getConstraintOrThrow
getConstraintOrThrow: (message?: string | (() => string)) => Type;
Gets the constraint or throws if it doesn't exist.
method getDefault
getDefault: () => Type | undefined;
Gets the default type or undefined if it doesn't exist.
method getDefaultOrThrow
getDefaultOrThrow: (message?: string | (() => string)) => Type;
Gets the default type or throws if it doesn't exist.
class TypeParameterDeclaration
class TypeParameterDeclaration extends TypeParameterDeclarationBase<ts.TypeParameterDeclaration> {}
method getConstraint
getConstraint: () => TypeNode | undefined;
Gets the constraint of the type parameter.
method getConstraintOrThrow
getConstraintOrThrow: ( message?: string | (() => string)) => TypeNode<ts.TypeNode>;
Gets the constraint of the type parameter or throws if it doesn't exist.
method getDefault
getDefault: () => TypeNode | undefined;
Gets the default node of the type parameter.
method getDefaultOrThrow
getDefaultOrThrow: (message?: string | (() => string)) => TypeNode<ts.TypeNode>;
Gets the default node of the type parameter or throws if it doesn't exist.
method getParent
getParent: () => NodeParentType<ts.TypeParameterDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TypeParameterDeclaration>>;
*
method getStructure
getStructure: () => TypeParameterDeclarationStructure;
Gets the structure equivalent to this node.
method getVariance
getVariance: () => TypeParameterVariance;
Gets the variance of the type parameter.
method isConst
isConst: () => boolean;
Gets if this is a const type parameter.
method remove
remove: () => void;
Removes this type parameter.
method removeConstraint
removeConstraint: () => this;
Removes the constraint type node.
method removeDefault
removeDefault: () => this;
Removes the default type node.
method set
set: (structure: Partial<TypeParameterDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setConstraint
setConstraint: (text: string | WriterFunction) => this;
Sets the type parameter constraint.
Parameter text
Text to set as the constraint.
method setDefault
setDefault: (text: string | WriterFunction) => this;
Sets the type parameter default type node.
Parameter text
Text to set as the default type node.
method setIsConst
setIsConst: (value: boolean) => this;
Sets if this is a const type parameter or not.
method setVariance
setVariance: (variance: TypeParameterVariance) => this;
Set the variance of the type parameter.
class TypePredicateNode
class TypePredicateNode extends TypeNode<ts.TypePredicateNode> {}
A type predicate node which says the specified parameter name is a specific type if the function returns true.
Examples: *
param is string
indeclare function isString(param: unknown): param is string;
. *asserts condition
indeclare function assert(condition: any): asserts condition;
.
method getAssertsModifier
getAssertsModifier: () => Node<ts.AssertsKeyword> | undefined;
Gets the asserts modifier if it exists.
method getAssertsModifierOrThrow
getAssertsModifierOrThrow: ( message?: string | (() => string)) => Node<ts.AssertsKeyword>;
Gets the asserts modifier if it exists or throws otherwise.
method getParameterNameNode
getParameterNameNode: () => Identifier | ThisTypeNode;
Gets the parameter name node
method getParent
getParent: () => NodeParentType<ts.TypePredicateNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TypePredicateNode>>;
*
method getTypeNode
getTypeNode: () => TypeNode | undefined;
Gets the type name if it exists or returns undefined when it asserts a condition.
method getTypeNodeOrThrow
getTypeNodeOrThrow: (message?: string | (() => string)) => TypeNode;
Gets the type name if it exists or throws when it asserts a condition.
method hasAssertsModifier
hasAssertsModifier: () => boolean;
Gets if the type predicate has an
asserts
modifier (ex.asserts condition
).
class TypeQueryNode
class TypeQueryNode extends NodeWithTypeArguments<ts.TypeQueryNode> {}
method getExprName
getExprName: () => EntityName;
Gets the expression name.
method getParent
getParent: () => NodeParentType<ts.TypeQueryNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TypeQueryNode>>;
*
class TypeReferenceNode
class TypeReferenceNode extends NodeWithTypeArguments<ts.TypeReferenceNode> {}
method getParent
getParent: () => NodeParentType<ts.TypeReferenceNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.TypeReferenceNode>>;
*
method getTypeName
getTypeName: () => EntityName;
Gets the type name.
class UnaryExpression
class UnaryExpression< T extends ts.UnaryExpression = ts.UnaryExpression> extends Expression<T> {}
class UnionTypeNode
class UnionTypeNode extends TypeNode<ts.UnionTypeNode> {}
method getParent
getParent: () => NodeParentType<ts.UnionTypeNode>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.UnionTypeNode>>;
*
method getTypeNodes
getTypeNodes: () => TypeNode[];
Gets the union type nodes.
class UpdateExpression
class UpdateExpression< T extends ts.UpdateExpression = ts.UpdateExpression> extends UnaryExpression<T> {}
class VariableDeclaration
class VariableDeclaration extends VariableDeclarationBase<ts.VariableDeclaration> {}
method getParent
getParent: () => NodeParentType<ts.VariableDeclaration>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.VariableDeclaration>>;
*
method getStructure
getStructure: () => VariableDeclarationStructure;
Gets the structure equivalent to this node.
method getVariableStatement
getVariableStatement: () => VariableStatement | undefined;
Gets the corresponding variable statement if it exists. Returns undefined for variable declarations in for statements.
method getVariableStatementOrThrow
getVariableStatementOrThrow: ( message?: string | (() => string)) => VariableStatement;
Gets the corresponding variable statement if it exists. Throws for variable declarations in for statements.
method remove
remove: () => void;
Removes this variable declaration.
method set
set: (structure: Partial<VariableDeclarationStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
class VariableDeclarationList
class VariableDeclarationList extends VariableDeclarationListBase<ts.VariableDeclarationList> {}
method addDeclaration
addDeclaration: ( structure: OptionalKind<VariableDeclarationStructure>) => VariableDeclaration;
Add a variable declaration to the statement.
Parameter structure
Structure representing the variable declaration to add.
method addDeclarations
addDeclarations: ( structures: ReadonlyArray<OptionalKind<VariableDeclarationStructure>>) => VariableDeclaration[];
Adds variable declarations to the statement.
Parameter structures
Structures representing the variable declarations to add.
method getDeclarationKind
getDeclarationKind: () => VariableDeclarationKind;
Gets the variable declaration kind.
method getDeclarationKindKeywords
getDeclarationKindKeywords: () => Node[];
Gets the variable declaration kind keywords.
method getDeclarations
getDeclarations: () => VariableDeclaration[];
Get the variable declarations.
method getParent
getParent: () => NodeParentType<ts.VariableDeclarationList>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.VariableDeclarationList>>;
*
method insertDeclaration
insertDeclaration: ( index: number, structure: OptionalKind<VariableDeclarationStructure>) => VariableDeclaration;
Inserts a variable declaration at the specified index within the statement.
Parameter index
Child index to insert at.
Parameter structure
Structure representing the variable declaration to insert.
method insertDeclarations
insertDeclarations: ( index: number, structures: ReadonlyArray<OptionalKind<VariableDeclarationStructure>>) => VariableDeclaration[];
Inserts variable declarations at the specified index within the statement.
Parameter index
Child index to insert at.
Parameter structures
Structures representing the variable declarations to insert.
method setDeclarationKind
setDeclarationKind: (type: VariableDeclarationKind) => this;
Sets the variable declaration kind.
Parameter type
Type to set.
class VariableStatement
class VariableStatement extends VariableStatementBase<ts.VariableStatement> {}
method addDeclaration
addDeclaration: ( structure: OptionalKind<VariableDeclarationStructure>) => VariableDeclaration;
Add a variable declaration to the statement.
Parameter structure
Structure representing the variable declaration to add.
method addDeclarations
addDeclarations: ( structures: ReadonlyArray<OptionalKind<VariableDeclarationStructure>>) => VariableDeclaration[];
Adds variable declarations to the statement.
Parameter structures
Structures representing the variable declarations to add.
method getDeclarationKind
getDeclarationKind: () => VariableDeclarationKind;
Gets the variable declaration kind.
method getDeclarationKindKeywords
getDeclarationKindKeywords: () => Node<ts.Node>[];
Gets the variable declaration kind keywords.
method getDeclarationList
getDeclarationList: () => VariableDeclarationList;
Get variable declaration list.
method getDeclarations
getDeclarations: () => VariableDeclaration[];
Get the variable declarations.
method getParent
getParent: () => NodeParentType<ts.VariableStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.VariableStatement>>;
*
method getStructure
getStructure: () => VariableStatementStructure;
Gets the structure equivalent to this node.
method insertDeclaration
insertDeclaration: ( index: number, structure: OptionalKind<VariableDeclarationStructure>) => VariableDeclaration;
Inserts a variable declaration at the specified index within the statement.
Parameter index
Child index to insert at.
Parameter structure
Structure representing the variable declaration to insert.
method insertDeclarations
insertDeclarations: ( index: number, structures: ReadonlyArray<OptionalKind<VariableDeclarationStructure>>) => VariableDeclaration[];
Inserts variable declarations at the specified index within the statement.
Parameter index
Child index to insert at.
Parameter structures
Structures representing the variable declarations to insert.
method set
set: (structure: Partial<VariableStatementStructure>) => this;
Sets the node from a structure.
Parameter structure
Structure to set the node with.
method setDeclarationKind
setDeclarationKind: (type: VariableDeclarationKind) => VariableDeclarationList;
Sets the variable declaration kind.
Parameter type
Type to set.
class VoidExpression
class VoidExpression extends VoidExpressionBase<ts.VoidExpression> {}
method getParent
getParent: () => NodeParentType<ts.VoidExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.VoidExpression>>;
*
class WhileStatement
class WhileStatement extends WhileStatementBase<ts.WhileStatement> {}
method getParent
getParent: () => NodeParentType<ts.WhileStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.WhileStatement>>;
*
class WithStatement
class WithStatement extends WithStatementBase<ts.WithStatement> {}
method getParent
getParent: () => NodeParentType<ts.WithStatement>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.WithStatement>>;
*
method getStatement
getStatement: () => Statement;
Gets this with statement's statement.
class Writers
class Writers {}
Functions for writing code.
method assertion
static assertion: ( type: WriterFunctionOrValue, assertionType: WriterFunctionOrValue) => (writer: CodeBlockWriter) => void;
Gets a writer function for writing a type assertion (ex.
type as assertionType
).
method intersectionType
static intersectionType: ( firstType: WriterFunctionOrValue, secondType: WriterFunctionOrValue, ...additionalTypes: WriterFunctionOrValue[]) => (writer: CodeBlockWriter) => void;
Gets a writer function for writing an intersection type (ex.
FirstType & SecondType
).
method object
static object: (obj: { [key: string]: WriterFunctionOrValue }) => WriterFunction;
Gets a writer function for writing the provided object as an object literal expression.
Parameter obj
Object to write.
method objectType
static objectType: ( structure: TypeElementMemberedNodeStructure) => WriterFunction;
Gets a writer function for writing an object type.
method returnStatement
static returnStatement: (value: WriterFunctionOrValue) => WriterFunction;
Gets a writer function for writing a return statement returning the provided value (ex.
return value;
).Parameter value
Value to be returned.
method unionType
static unionType: ( firstType: WriterFunctionOrValue, secondType: WriterFunctionOrValue, ...additionalTypes: WriterFunctionOrValue[]) => (writer: CodeBlockWriter) => void;
Gets a writer function for writing a union type (ex.
FirstType | SecondType
).
class YieldExpression
class YieldExpression extends YieldExpressionBase<ts.YieldExpression> {}
method getParent
getParent: () => NodeParentType<ts.YieldExpression>;
*
method getParentOrThrow
getParentOrThrow: ( message?: string | (() => string)) => NonNullable<NodeParentType<ts.YieldExpression>>;
*
Interfaces
interface AbstractableNode
interface AbstractableNode {}
method getAbstractKeyword
getAbstractKeyword: () => Node | undefined;
Gets the abstract keyword or undefined if it doesn't exist.
method getAbstractKeywordOrThrow
getAbstractKeywordOrThrow: (message?: string | (() => string)) => Node;
Gets the abstract keyword or throws if it doesn't exist.
method isAbstract
isAbstract: () => boolean;
Gets if the node is abstract.
method setIsAbstract
setIsAbstract: (isAbstract: boolean) => this;
Sets if the node is abstract.
Parameter isAbstract
If it should be abstract or not.
interface AbstractableNodeStructure
interface AbstractableNodeStructure {}
property isAbstract
isAbstract?: boolean;
interface AmbientableNode
interface AmbientableNode {}
method getDeclareKeyword
getDeclareKeyword: () => Node | undefined;
Gets the declare keyword or undefined if none exists.
method getDeclareKeywordOrThrow
getDeclareKeywordOrThrow: (message?: string | (() => string)) => Node;
Gets the declare keyword or throws if it doesn't exist.
method hasDeclareKeyword
hasDeclareKeyword: () => boolean;
If the node has the declare keyword.
method isAmbient
isAmbient: () => boolean;
Gets if the node is ambient.
method setHasDeclareKeyword
setHasDeclareKeyword: (value?: boolean) => this;
Sets if this node has a declare keyword.
Parameter value
To add the declare keyword or not.
interface AmbientableNodeStructure
interface AmbientableNodeStructure {}
property hasDeclareKeyword
hasDeclareKeyword?: boolean;
interface ApplyFileTextChangesOptions
interface ApplyFileTextChangesOptions {}
property overwrite
overwrite?: boolean;
If a file should be overwritten when the file text change is for a new file, but the file currently exists.
interface ArgumentedNode
interface ArgumentedNode {}
method addArgument
addArgument: (argumentText: string | WriterFunction) => Node;
Adds an argument.
Parameter argumentText
Argument text to add.
method addArguments
addArguments: ( argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction) => Node[];
Adds arguments.
Parameter argumentTexts
Argument texts to add.
method getArguments
getArguments: () => Node[];
Gets all the arguments of the node.
method insertArgument
insertArgument: (index: number, argumentText: string | WriterFunction) => Node;
Inserts an argument.
Parameter index
Child index to insert at.
Parameter argumentText
Argument text to insert.
method insertArguments
insertArguments: ( index: number, argumentTexts: ReadonlyArray<string | WriterFunction> | WriterFunction) => Node[];
Inserts arguments.
Parameter index
Child index to insert at.
Parameter argumentTexts
Argument texts to insert.
method removeArgument
removeArgument: { (arg: Node): this; (index: number): this };
Removes an argument.
Parameter arg
Argument to remove.
Removes an argument.
Parameter index
Index to remove.
interface AsyncableNode
interface AsyncableNode {}
method getAsyncKeyword
getAsyncKeyword: () => Node<ts.AsyncKeyword> | undefined;
Gets the async keyword or undefined if none exists.
method getAsyncKeywordOrThrow
getAsyncKeywordOrThrow: ( message?: string | (() => string)) => Node<ts.AsyncKeyword>;
Gets the async keyword or throws if none exists.
method isAsync
isAsync: () => boolean;
If it's async.
method setIsAsync
setIsAsync: (value: boolean) => this;
Sets if the node is async.
Parameter value
If it should be async or not.
interface AsyncableNodeStructure
interface AsyncableNodeStructure {}
property isAsync
isAsync?: boolean;
interface AwaitableNode
interface AwaitableNode {}
method getAwaitKeyword
getAwaitKeyword: () => Node<ts.AwaitKeyword> | undefined;
Gets the await token or undefined if none exists.
method getAwaitKeywordOrThrow
getAwaitKeywordOrThrow: ( message?: string | (() => string)) => Node<ts.AwaitKeyword>;
Gets the await token or throws if none exists.
method isAwaited
isAwaited: () => boolean;
If it's an awaited node.
method setIsAwaited
setIsAwaited: (value: boolean) => this;
Sets if the node is awaited.
Parameter value
If it should be awaited or not.
interface AwaitableNodeStructure
interface AwaitableNodeStructure {}
property isAwaited
isAwaited?: boolean;
interface BaseExpressionedNode
interface BaseExpressionedNode<TExpression extends Node> {}
method getExpression
getExpression: () => TExpression;
Gets the expression.
method getExpressionIfKind
getExpressionIfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToExpressionMappings[TKind] | undefined;
Gets the expression if its of a certain kind or returns undefined.
Parameter kind
Syntax kind of the expression.
method getExpressionIfKindOrThrow
getExpressionIfKindOrThrow: <TKind extends SyntaxKind>( kind: TKind) => KindToExpressionMappings[TKind];
Gets the expression if its of a certain kind or throws.
Parameter kind
Syntax kind of the expression.
method setExpression
setExpression: (textOrWriterFunction: string | WriterFunction) => this;
Sets the expression.
Parameter textOrWriterFunction
Text to set the expression with.
interface BindingNamedNode
interface BindingNamedNode extends BindingNamedNodeSpecific, ReferenceFindableNode, RenameableNode {}
interface BindingNamedNodeStructure
interface BindingNamedNodeStructure {}
property name
name: string;
interface BodiedNode
interface BodiedNode {}
method getBody
getBody: () => Node;
Gets the body.
method getBodyText
getBodyText: () => string;
Gets the body text without leading whitespace, leading indentation, or trailing whitespace.
method setBodyText
setBodyText: (textOrWriterFunction: string | WriterFunction) => this;
Sets the body text.
Parameter textOrWriterFunction
Text or writer function to set as the body.
interface BodyableNode
interface BodyableNode {}
method addBody
addBody: () => this;
Adds a body if it doesn't exists.
method getBody
getBody: () => Node | undefined;
Gets the body if it exists.
method getBodyOrThrow
getBodyOrThrow: (message?: string | (() => string)) => Node;
Gets the body or throws an error if it doesn't exist.
method getBodyText
getBodyText: () => string | undefined;
Gets the body text without leading whitespace, leading indentation, or trailing whitespace. Returns undefined if there is no body.
method hasBody
hasBody: () => boolean;
Gets if the node has a body.
method removeBody
removeBody: () => this;
Removes the body if it exists.
method setBodyText
setBodyText: (textOrWriterFunction: string | WriterFunction) => this;
Sets the body text. A body is required to do this operation.
Parameter textOrWriterFunction
Text or writer function to set as the body.
interface CallSignatureDeclarationStructure
interface CallSignatureDeclarationStructure extends Structure, CallSignatureDeclarationSpecificStructure, JSDocableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure {}
interface ChildOrderableNode
interface ChildOrderableNode {}
method setOrder
setOrder: (order: number) => this;
Sets the child order of the node within the parent.
interface ClassDeclarationStructure
interface ClassDeclarationStructure extends Structure, ClassLikeDeclarationBaseStructure, ClassDeclarationSpecificStructure, AmbientableNodeStructure, ExportableNodeStructure {}
property name
name?: string;
The class name.
Remarks
Can be undefined. For example:
export default class { ... }
interface ClassLikeDeclarationBase
interface ClassLikeDeclarationBase extends NameableNode, TextInsertableNode, ImplementsClauseableNode, HeritageClauseableNode, AbstractableNode, JSDocableNode, TypeParameteredNode, DecoratableNode, ModifierableNode, ClassLikeDeclarationBaseSpecific {}
interface ClassLikeDeclarationBaseStructure
interface ClassLikeDeclarationBaseStructure extends NameableNodeStructure, ClassLikeDeclarationBaseSpecificStructure, ImplementsClauseableNodeStructure, DecoratableNodeStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, AbstractableNodeStructure {}
interface ClassStaticBlockDeclarationStructure
interface ClassStaticBlockDeclarationStructure extends Structure, ClassStaticBlockDeclarationSpecificStructure, JSDocableNodeStructure, StatementedNodeStructure {}
interface CodeBlockWriterOptions
interface CodeBlockWriterOptions {}
Options for the writer.
property indentNumberOfSpaces
indentNumberOfSpaces: number;
Number of spaces to indent when
useTabs
is false.Remarks
Defaults to 4.
property newLine
newLine: '\n' | '\r\n';
Newline character.
Remarks
Defaults to \n.
property useSingleQuote
useSingleQuote: boolean;
Whether to use a single quote (true) or double quote (false).
Remarks
Defaults to false.
property useTabs
useTabs: boolean;
Whether to use tabs (true) or spaces (false).
Remarks
Defaults to false.
interface CompilerOptionsFromTsConfigOptions
interface CompilerOptionsFromTsConfigOptions {}
property encoding
encoding?: string;
property fileSystem
fileSystem?: FileSystemHost;
interface CompilerOptionsFromTsConfigResult
interface CompilerOptionsFromTsConfigResult {}
interface ConstructorDeclarationOverloadStructure
interface ConstructorDeclarationOverloadStructure extends Structure, ConstructorDeclarationOverloadSpecificStructure, ScopedNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure, JSDocableNodeStructure {}
interface ConstructorDeclarationStructure
interface ConstructorDeclarationStructure extends Structure, ConstructorDeclarationSpecificStructure, ScopedNodeStructure, FunctionLikeDeclarationStructure {}
interface ConstructSignatureDeclarationStructure
interface ConstructSignatureDeclarationStructure extends Structure, ConstructSignatureDeclarationSpecificStructure, JSDocableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure {}
interface CreateWrappedNodeOptions
interface CreateWrappedNodeOptions {}
property compilerOptions
compilerOptions?: CompilerOptions;
Compiler options.
property sourceFile
sourceFile?: ts.SourceFile;
Optional source file of the node. Will make it not bother going up the tree to find the source file.
property typeChecker
typeChecker?: ts.TypeChecker;
Type checker.
interface DecoratableNode
interface DecoratableNode {}
method addDecorator
addDecorator: (structure: OptionalKind<DecoratorStructure>) => Decorator;
Adds a decorator.
Parameter structure
Structure of the decorator.
method addDecorators
addDecorators: ( structures: ReadonlyArray<OptionalKind<DecoratorStructure>>) => Decorator[];
Adds decorators.
Parameter structures
Structures of the decorators.
method getDecorator
getDecorator: { (name: string): Decorator | undefined; (findFunction: (declaration: Decorator) => boolean): Decorator;};
Gets a decorator or undefined if it doesn't exist.
Parameter name
Name of the parameter.
Gets a decorator or undefined if it doesn't exist.
Parameter findFunction
Function to use to find the parameter.
method getDecoratorOrThrow
getDecoratorOrThrow: { (name: string): Decorator; (findFunction: (declaration: Decorator) => boolean): Decorator;};
Gets a decorator or throws if it doesn't exist.
Parameter name
Name of the parameter.
Gets a decorator or throws if it doesn't exist.
Parameter findFunction
Function to use to find the parameter.
method getDecorators
getDecorators: () => Decorator[];
Gets all the decorators of the node.
method insertDecorator
insertDecorator: ( index: number, structure: OptionalKind<DecoratorStructure>) => Decorator;
Inserts a decorator.
Parameter index
Child index to insert at. Specify a negative index to insert from the reverse.
Parameter structure
Structure of the decorator.
method insertDecorators
insertDecorators: ( index: number, structures: ReadonlyArray<OptionalKind<DecoratorStructure>>) => Decorator[];
Insert decorators.
Parameter index
Child index to insert at.
Parameter structures
Structures to insert.
interface DecoratableNodeStructure
interface DecoratableNodeStructure {}
property decorators
decorators?: OptionalKind<DecoratorStructure>[];
interface DecoratorStructure
interface DecoratorStructure extends Structure, DecoratorSpecificStructure {}
interface DirectoryAddOptions
interface DirectoryAddOptions {}
property recursive
recursive?: boolean;
Whether to also recursively add all the directory's descendant directories.
Remarks
Defaults to false.
interface DirectoryCopyOptions
interface DirectoryCopyOptions extends SourceFileCopyOptions {}
property includeUntrackedFiles
includeUntrackedFiles?: boolean;
Includes all the files in the directory and sub-directory when copying.
Remarks
- Defaults to true.
interface DirectoryMoveOptions
interface DirectoryMoveOptions extends SourceFileMoveOptions {}
interface DotDotDotTokenableNode
interface DotDotDotTokenableNode {}
method getDotDotDotToken
getDotDotDotToken: () => Node<ts.DotDotDotToken> | undefined;
Gets the dot dot dot token (...) if it exists or returns undefined
method getDotDotDotTokenOrThrow
getDotDotDotTokenOrThrow: ( message?: string | (() => string)) => Node<ts.DotDotDotToken>;
Gets the dot dot dot token (...) if it exists or throws if not.
interface EmitOptions
interface EmitOptions extends EmitOptionsBase {}
Options for emitting.
property targetSourceFile
targetSourceFile?: SourceFile;
Optional source file to only emit.
interface EmitOptionsBase
interface EmitOptionsBase {}
property customTransformers
customTransformers?: ts.CustomTransformers;
Transformers to act on the files when emitting.
property emitOnlyDtsFiles
emitOnlyDtsFiles?: boolean;
Whether only .d.ts files should be emitted.
interface EnumDeclarationStructure
interface EnumDeclarationStructure extends Structure, NamedNodeStructure, EnumDeclarationSpecificStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure {}
interface EnumMemberStructure
interface EnumMemberStructure extends Structure, EnumMemberSpecificStructure, PropertyNamedNodeStructure, JSDocableNodeStructure, InitializerExpressionableNodeStructure {}
interface ExclamationTokenableNode
interface ExclamationTokenableNode {}
method getExclamationTokenNode
getExclamationTokenNode: () => Node<ts.ExclamationToken> | undefined;
Gets the exclamation token node or returns undefined if it doesn't exist.
method getExclamationTokenNodeOrThrow
getExclamationTokenNodeOrThrow: ( message?: string | (() => string)) => Node<ts.ExclamationToken>;
Gets the exclamation token node or throws.
method hasExclamationToken
hasExclamationToken: () => boolean;
If it has a exclamation token.
method setHasExclamationToken
setHasExclamationToken: (value: boolean) => this;
Sets if this node has a exclamation token.
Parameter value
If it should have a exclamation token or not.
interface ExclamationTokenableNodeStructure
interface ExclamationTokenableNodeStructure {}
property hasExclamationToken
hasExclamationToken?: boolean;
interface ExportableNode
interface ExportableNode extends ExportGetableNode {}
method setIsDefaultExport
setIsDefaultExport: (value: boolean) => this;
Sets if this node is a default export of a file.
Parameter value
If it should be a default export or not.
method setIsExported
setIsExported: (value: boolean) => this;
Sets if the node is exported.
Note: Will remove the default keyword if set.
Parameter value
If it should be exported or not.
interface ExportableNodeStructure
interface ExportableNodeStructure {}
property isDefaultExport
isDefaultExport?: boolean;
property isExported
isExported?: boolean;
interface ExportAssignmentStructure
interface ExportAssignmentStructure extends Structure, ExportAssignmentSpecificStructure, JSDocableNodeStructure {}
interface ExportDeclarationStructure
interface ExportDeclarationStructure extends Structure, ExportDeclarationSpecificStructure {}
interface ExportGetableNode
interface ExportGetableNode {}
method getDefaultKeyword
getDefaultKeyword: () => Node | undefined;
Gets the default keyword or undefined if none exists.
method getDefaultKeywordOrThrow
getDefaultKeywordOrThrow: (message?: string | (() => string)) => Node;
Gets the default keyword or throws if none exists.
method getExportKeyword
getExportKeyword: () => Node | undefined;
Gets the export keyword or undefined if none exists.
method getExportKeywordOrThrow
getExportKeywordOrThrow: (message?: string | (() => string)) => Node;
Gets the export keyword or throws if none exists.
method hasDefaultKeyword
hasDefaultKeyword: () => boolean;
If the node has the default keyword.
method hasExportKeyword
hasExportKeyword: () => boolean;
If the node has the export keyword.
method isDefaultExport
isDefaultExport: () => boolean;
Gets if this node is a default export of a file.
method isExported
isExported: () => boolean;
Gets if the node is exported from a namespace, is a default export, or is a named export.
method isNamedExport
isNamedExport: () => boolean;
Gets if this node is a named export of a file.
interface ExportSpecifierStructure
interface ExportSpecifierStructure extends Structure, ExportSpecifierSpecificStructure {}
interface ExpressionableNode
interface ExpressionableNode {}
method getExpression
getExpression: () => Expression | undefined;
Gets the expression if it exists or returns undefined.
method getExpressionIfKind
getExpressionIfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToExpressionMappings[TKind] | undefined;
Gets the expression if it is of the specified syntax kind or returns undefined.
method getExpressionIfKindOrThrow
getExpressionIfKindOrThrow: <TKind extends SyntaxKind>( kind: TKind) => KindToExpressionMappings[TKind];
Gets the expression if it is of the specified syntax kind or throws.
method getExpressionOrThrow
getExpressionOrThrow: (message?: string | (() => string)) => Expression;
Gets the expression if it exists or throws.
interface ExpressionedNode
interface ExpressionedNode extends BaseExpressionedNode<Expression> {}
interface ExpressionedNodeStructure
interface ExpressionedNodeStructure {}
property expression
expression: string | WriterFunction;
interface ExtendsClauseableNode
interface ExtendsClauseableNode {}
method addExtends
addExtends: { ( texts: ReadonlyArray<string | WriterFunction> | WriterFunction ): ExpressionWithTypeArguments[]; (text: string): ExpressionWithTypeArguments;};
Adds multiple extends clauses.
Parameter texts
Texts to add for the extends clause.
Adds an extends clause.
Parameter text
Text to add for the extends clause.
method getExtends
getExtends: () => ExpressionWithTypeArguments[];
Gets the extends clauses.
method insertExtends
insertExtends: { ( index: number, texts: ReadonlyArray<string | WriterFunction> | WriterFunction ): ExpressionWithTypeArguments[]; (index: number, text: string): ExpressionWithTypeArguments;};
Inserts multiple extends clauses.
Parameter texts
Texts to insert for the extends clause.
Inserts an extends clause.
Parameter text
Text to insert for the extends clause.
method removeExtends
removeExtends: { (index: number): this; (extendsNode: ExpressionWithTypeArguments): this;};
Removes the extends at the specified index.
Parameter index
Index to remove.
Removes the specified extends.
Parameter extendsNode
Node of the extend to remove.
interface ExtendsClauseableNodeStructure
interface ExtendsClauseableNodeStructure {}
property extends
extends?: (string | WriterFunction)[] | WriterFunction;
interface FileSystemHost
interface FileSystemHost {}
Represents a file system that can be interacted with.
method copy
copy: (srcPath: string, destPath: string) => Promise<void>;
Asynchronously copies a file or directory.
method copySync
copySync: (srcPath: string, destPath: string) => void;
Synchronously copies a file or directory.
method delete
delete: (path: string) => Promise<void>;
Asynchronously deletes the specified file or directory.
method deleteSync
deleteSync: (path: string) => void;
Synchronously deletes the specified file or directory
method directoryExists
directoryExists: (dirPath: string) => Promise<boolean>;
Asynchronously checks if a directory exists.
method directoryExistsSync
directoryExistsSync: (dirPath: string) => boolean;
Synchronously checks if a directory exists.
method fileExists
fileExists: (filePath: string) => Promise<boolean>;
Asynchronously checks if a file exists.
Remarks
Implementers should throw an
errors.FileNotFoundError
when it does not exist.
method fileExistsSync
fileExistsSync: (filePath: string) => boolean;
Synchronously checks if a file exists.
Remarks
Implementers should throw an
errors.FileNotFoundError
when it does not exist.
method getCurrentDirectory
getCurrentDirectory: () => string;
Gets the current directory of the environment.
method glob
glob: (patterns: ReadonlyArray<string>) => Promise<string[]>;
Uses pattern matching to find files or directories.
method globSync
globSync: (patterns: ReadonlyArray<string>) => string[];
Synchronously uses pattern matching to find files or directories.
method isCaseSensitive
isCaseSensitive: () => boolean;
Gets if this file system is case sensitive.
method mkdir
mkdir: (dirPath: string) => Promise<void>;
Asynchronously creates a directory at the specified path.
method mkdirSync
mkdirSync: (dirPath: string) => void;
Synchronously creates a directory at the specified path.
method move
move: (srcPath: string, destPath: string) => Promise<void>;
Asynchronously moves a file or directory.
method moveSync
moveSync: (srcPath: string, destPath: string) => void;
Synchronously moves a file or directory.
method readDirSync
readDirSync: (dirPath: string) => RuntimeDirEntry[];
Reads all the child directories and files.
Remarks
Implementers should have this return the full file path.
method readFile
readFile: (filePath: string, encoding?: string) => Promise<string>;
Asynchronously reads a file at the specified path.
method readFileSync
readFileSync: (filePath: string, encoding?: string) => string;
Synchronously reads a file at the specified path.
method realpathSync
realpathSync: (path: string) => string;
See https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options
method writeFile
writeFile: (filePath: string, fileText: string) => Promise<void>;
Asynchronously writes a file to the file system.
method writeFileSync
writeFileSync: (filePath: string, fileText: string) => void;
Synchronously writes a file to the file system.
interface ForEachDescendantTraversalControl
interface ForEachDescendantTraversalControl {}
interface FormatCodeSettings
interface FormatCodeSettings extends ts.FormatCodeSettings {}
property ensureNewLineAtEndOfFile
ensureNewLineAtEndOfFile?: boolean;
interface FunctionDeclarationOverloadStructure
interface FunctionDeclarationOverloadStructure extends Structure, FunctionDeclarationOverloadSpecificStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, AsyncableNodeStructure, GeneratorableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure {}
interface FunctionDeclarationStructure
interface FunctionDeclarationStructure extends Structure, FunctionDeclarationSpecificStructure, NameableNodeStructure, FunctionLikeDeclarationStructure, AsyncableNodeStructure, GeneratorableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure {}
interface FunctionLikeDeclaration
interface FunctionLikeDeclaration extends JSDocableNode, TypeParameteredNode, SignaturedDeclaration, StatementedNode, ModifierableNode {}
interface FunctionLikeDeclarationStructure
interface FunctionLikeDeclarationStructure extends SignaturedDeclarationStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, StatementedNodeStructure {}
interface GeneratorableNode
interface GeneratorableNode {}
method getAsteriskToken
getAsteriskToken: () => Node<ts.AsteriskToken> | undefined;
Gets the asterisk token or undefined if none exists.
method getAsteriskTokenOrThrow
getAsteriskTokenOrThrow: ( message?: string | (() => string)) => Node<ts.AsteriskToken>;
Gets the asterisk token or throws if none exists.
method isGenerator
isGenerator: () => boolean;
If it's a generator function.
method setIsGenerator
setIsGenerator: (value: boolean) => this;
Sets if the node is a generator.
Parameter value
If it should be a generator or not.
interface GeneratorableNodeStructure
interface GeneratorableNodeStructure {}
property isGenerator
isGenerator?: boolean;
interface GetAccessorDeclarationStructure
interface GetAccessorDeclarationStructure extends Structure, GetAccessorDeclarationSpecificStructure, PropertyNamedNodeStructure, StaticableNodeStructure, DecoratableNodeStructure, AbstractableNodeStructure, ScopedNodeStructure, FunctionLikeDeclarationStructure {}
interface HeritageClauseableNode
interface HeritageClauseableNode {}
method getHeritageClauseByKind
getHeritageClauseByKind: ( kind: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword) => HeritageClause | undefined;
Gets the heritage clause by kind. - Kind of heritage clause.
method getHeritageClauseByKindOrThrow
getHeritageClauseByKindOrThrow: ( kind: SyntaxKind.ExtendsKeyword | SyntaxKind.ImplementsKeyword) => HeritageClause;
Gets the heritage clause by kind or throws if it doesn't exist. - Kind of heritage clause.
method getHeritageClauses
getHeritageClauses: () => HeritageClause[];
Gets the heritage clauses of the node.
interface ImplementedKindToNodeMappings
interface ImplementedKindToNodeMappings {}
property [SyntaxKind.AnyKeyword]
[SyntaxKind.AnyKeyword]: Expression;
property [SyntaxKind.ArrayBindingPattern]
[SyntaxKind.ArrayBindingPattern]: ArrayBindingPattern;
property [SyntaxKind.ArrayLiteralExpression]
[SyntaxKind.ArrayLiteralExpression]: ArrayLiteralExpression;
property [SyntaxKind.ArrayType]
[SyntaxKind.ArrayType]: ArrayTypeNode;
property [SyntaxKind.ArrowFunction]
[SyntaxKind.ArrowFunction]: ArrowFunction;
property [SyntaxKind.AsExpression]
[SyntaxKind.AsExpression]: AsExpression;
property [SyntaxKind.AwaitExpression]
[SyntaxKind.AwaitExpression]: AwaitExpression;
property [SyntaxKind.BigIntLiteral]
[SyntaxKind.BigIntLiteral]: BigIntLiteral;
property [SyntaxKind.BinaryExpression]
[SyntaxKind.BinaryExpression]: BinaryExpression;
property [SyntaxKind.BindingElement]
[SyntaxKind.BindingElement]: BindingElement;
property [SyntaxKind.Block]
[SyntaxKind.Block]: Block;
property [SyntaxKind.BooleanKeyword]
[SyntaxKind.BooleanKeyword]: Expression;
property [SyntaxKind.BreakStatement]
[SyntaxKind.BreakStatement]: BreakStatement;
property [SyntaxKind.CallExpression]
[SyntaxKind.CallExpression]: CallExpression;
property [SyntaxKind.CallSignature]
[SyntaxKind.CallSignature]: CallSignatureDeclaration;
property [SyntaxKind.CaseBlock]
[SyntaxKind.CaseBlock]: CaseBlock;
property [SyntaxKind.CaseClause]
[SyntaxKind.CaseClause]: CaseClause;
property [SyntaxKind.CatchClause]
[SyntaxKind.CatchClause]: CatchClause;
property [SyntaxKind.ClassDeclaration]
[SyntaxKind.ClassDeclaration]: ClassDeclaration;
property [SyntaxKind.ClassExpression]
[SyntaxKind.ClassExpression]: ClassExpression;
property [SyntaxKind.ClassStaticBlockDeclaration]
[SyntaxKind.ClassStaticBlockDeclaration]: ClassStaticBlockDeclaration;
property [SyntaxKind.CommaListExpression]
[SyntaxKind.CommaListExpression]: CommaListExpression;
property [SyntaxKind.ComputedPropertyName]
[SyntaxKind.ComputedPropertyName]: ComputedPropertyName;
property [SyntaxKind.ConditionalExpression]
[SyntaxKind.ConditionalExpression]: ConditionalExpression;
property [SyntaxKind.ConditionalType]
[SyntaxKind.ConditionalType]: ConditionalTypeNode;
property [SyntaxKind.Constructor]
[SyntaxKind.Constructor]: ConstructorDeclaration;
property [SyntaxKind.ConstructorType]
[SyntaxKind.ConstructorType]: ConstructorTypeNode;
property [SyntaxKind.ConstructSignature]
[SyntaxKind.ConstructSignature]: ConstructSignatureDeclaration;
property [SyntaxKind.ContinueStatement]
[SyntaxKind.ContinueStatement]: ContinueStatement;
property [SyntaxKind.DebuggerStatement]
[SyntaxKind.DebuggerStatement]: DebuggerStatement;
property [SyntaxKind.Decorator]
[SyntaxKind.Decorator]: Decorator;
property [SyntaxKind.DefaultClause]
[SyntaxKind.DefaultClause]: DefaultClause;
property [SyntaxKind.DeleteExpression]
[SyntaxKind.DeleteExpression]: DeleteExpression;
property [SyntaxKind.DoStatement]
[SyntaxKind.DoStatement]: DoStatement;
property [SyntaxKind.ElementAccessExpression]
[SyntaxKind.ElementAccessExpression]: ElementAccessExpression;
property [SyntaxKind.EmptyStatement]
[SyntaxKind.EmptyStatement]: EmptyStatement;
property [SyntaxKind.EnumDeclaration]
[SyntaxKind.EnumDeclaration]: EnumDeclaration;
property [SyntaxKind.EnumMember]
[SyntaxKind.EnumMember]: EnumMember;
property [SyntaxKind.ExportAssignment]
[SyntaxKind.ExportAssignment]: ExportAssignment;
property [SyntaxKind.ExportDeclaration]
[SyntaxKind.ExportDeclaration]: ExportDeclaration;
property [SyntaxKind.ExportSpecifier]
[SyntaxKind.ExportSpecifier]: ExportSpecifier;
property [SyntaxKind.ExpressionStatement]
[SyntaxKind.ExpressionStatement]: ExpressionStatement;
property [SyntaxKind.ExpressionWithTypeArguments]
[SyntaxKind.ExpressionWithTypeArguments]: ExpressionWithTypeArguments;
property [SyntaxKind.ExternalModuleReference]
[SyntaxKind.ExternalModuleReference]: ExternalModuleReference;
property [SyntaxKind.FalseKeyword]
[SyntaxKind.FalseKeyword]: FalseLiteral;
property [SyntaxKind.ForInStatement]
[SyntaxKind.ForInStatement]: ForInStatement;
property [SyntaxKind.ForOfStatement]
[SyntaxKind.ForOfStatement]: ForOfStatement;
property [SyntaxKind.ForStatement]
[SyntaxKind.ForStatement]: ForStatement;
property [SyntaxKind.FunctionDeclaration]
[SyntaxKind.FunctionDeclaration]: FunctionDeclaration;
property [SyntaxKind.FunctionExpression]
[SyntaxKind.FunctionExpression]: FunctionExpression;
property [SyntaxKind.FunctionType]
[SyntaxKind.FunctionType]: FunctionTypeNode;
property [SyntaxKind.GetAccessor]
[SyntaxKind.GetAccessor]: GetAccessorDeclaration;
property [SyntaxKind.HeritageClause]
[SyntaxKind.HeritageClause]: HeritageClause;
property [SyntaxKind.Identifier]
[SyntaxKind.Identifier]: Identifier;
property [SyntaxKind.IfStatement]
[SyntaxKind.IfStatement]: IfStatement;
property [SyntaxKind.ImportAttribute]
[SyntaxKind.ImportAttribute]: ImportAttribute;
property [SyntaxKind.ImportAttributes]
[SyntaxKind.ImportAttributes]: ImportAttributes;
property [SyntaxKind.ImportClause]
[SyntaxKind.ImportClause]: ImportClause;
property [SyntaxKind.ImportDeclaration]
[SyntaxKind.ImportDeclaration]: ImportDeclaration;
property [SyntaxKind.ImportEqualsDeclaration]
[SyntaxKind.ImportEqualsDeclaration]: ImportEqualsDeclaration;
property [SyntaxKind.ImportKeyword]
[SyntaxKind.ImportKeyword]: ImportExpression;
property [SyntaxKind.ImportSpecifier]
[SyntaxKind.ImportSpecifier]: ImportSpecifier;
property [SyntaxKind.ImportType]
[SyntaxKind.ImportType]: ImportTypeNode;
property [SyntaxKind.IndexedAccessType]
[SyntaxKind.IndexedAccessType]: IndexedAccessTypeNode;
property [SyntaxKind.IndexSignature]
[SyntaxKind.IndexSignature]: IndexSignatureDeclaration;
property [SyntaxKind.InferKeyword]
[SyntaxKind.InferKeyword]: Node<ts.Token<SyntaxKind.InferKeyword>>;
property [SyntaxKind.InferType]
[SyntaxKind.InferType]: InferTypeNode;
property [SyntaxKind.InterfaceDeclaration]
[SyntaxKind.InterfaceDeclaration]: InterfaceDeclaration;
property [SyntaxKind.IntersectionType]
[SyntaxKind.IntersectionType]: IntersectionTypeNode;
property [SyntaxKind.JSDoc]
[SyntaxKind.JSDoc]: JSDoc;
property [SyntaxKind.JSDocAllType]
[SyntaxKind.JSDocAllType]: JSDocAllType;
property [SyntaxKind.JSDocAugmentsTag]
[SyntaxKind.JSDocAugmentsTag]: JSDocAugmentsTag;
property [SyntaxKind.JSDocAuthorTag]
[SyntaxKind.JSDocAuthorTag]: JSDocAuthorTag;
property [SyntaxKind.JSDocCallbackTag]
[SyntaxKind.JSDocCallbackTag]: JSDocCallbackTag;
property [SyntaxKind.JSDocClassTag]
[SyntaxKind.JSDocClassTag]: JSDocClassTag;
property [SyntaxKind.JSDocDeprecatedTag]
[SyntaxKind.JSDocDeprecatedTag]: JSDocDeprecatedTag;
property [SyntaxKind.JSDocEnumTag]
[SyntaxKind.JSDocEnumTag]: JSDocEnumTag;
property [SyntaxKind.JSDocFunctionType]
[SyntaxKind.JSDocFunctionType]: JSDocFunctionType;
property [SyntaxKind.JSDocImplementsTag]
[SyntaxKind.JSDocImplementsTag]: JSDocImplementsTag;
property [SyntaxKind.JSDocLink]
[SyntaxKind.JSDocLink]: JSDocLink;
property [SyntaxKind.JSDocLinkCode]
[SyntaxKind.JSDocLinkCode]: JSDocLinkCode;
property [SyntaxKind.JSDocLinkPlain]
[SyntaxKind.JSDocLinkPlain]: JSDocLinkPlain;
property [SyntaxKind.JSDocMemberName]
[SyntaxKind.JSDocMemberName]: JSDocMemberName;
property [SyntaxKind.JSDocNamepathType]
[SyntaxKind.JSDocNamepathType]: JSDocNamepathType;
property [SyntaxKind.JSDocNameReference]
[SyntaxKind.JSDocNameReference]: JSDocNameReference;
property [SyntaxKind.JSDocNonNullableType]
[SyntaxKind.JSDocNonNullableType]: JSDocNonNullableType;
property [SyntaxKind.JSDocNullableType]
[SyntaxKind.JSDocNullableType]: JSDocNullableType;
property [SyntaxKind.JSDocOptionalType]
[SyntaxKind.JSDocOptionalType]: JSDocOptionalType;
property [SyntaxKind.JSDocOverloadTag]
[SyntaxKind.JSDocOverloadTag]: JSDocOverloadTag;
property [SyntaxKind.JSDocOverrideTag]
[SyntaxKind.JSDocOverrideTag]: JSDocOverrideTag;
property [SyntaxKind.JSDocParameterTag]
[SyntaxKind.JSDocParameterTag]: JSDocParameterTag;
property [SyntaxKind.JSDocPrivateTag]
[SyntaxKind.JSDocPrivateTag]: JSDocPrivateTag;
property [SyntaxKind.JSDocPropertyTag]
[SyntaxKind.JSDocPropertyTag]: JSDocPropertyTag;
property [SyntaxKind.JSDocProtectedTag]
[SyntaxKind.JSDocProtectedTag]: JSDocProtectedTag;
property [SyntaxKind.JSDocPublicTag]
[SyntaxKind.JSDocPublicTag]: JSDocPublicTag;
property [SyntaxKind.JSDocReadonlyTag]
[SyntaxKind.JSDocReadonlyTag]: JSDocReadonlyTag;
property [SyntaxKind.JSDocReturnTag]
[SyntaxKind.JSDocReturnTag]: JSDocReturnTag;
property [SyntaxKind.JSDocSatisfiesTag]
[SyntaxKind.JSDocSatisfiesTag]: JSDocSatisfiesTag;
property [SyntaxKind.JSDocSeeTag]
[SyntaxKind.JSDocSeeTag]: JSDocSeeTag;
property [SyntaxKind.JSDocSignature]
[SyntaxKind.JSDocSignature]: JSDocSignature;
property [SyntaxKind.JSDocTag]
[SyntaxKind.JSDocTag]: JSDocUnknownTag;
property [SyntaxKind.JSDocTemplateTag]
[SyntaxKind.JSDocTemplateTag]: JSDocTemplateTag;
property [SyntaxKind.JSDocText]
[SyntaxKind.JSDocText]: JSDocText;
property [SyntaxKind.JSDocThisTag]
[SyntaxKind.JSDocThisTag]: JSDocThisTag;
property [SyntaxKind.JSDocThrowsTag]
[SyntaxKind.JSDocThrowsTag]: JSDocThrowsTag;
property [SyntaxKind.JSDocTypedefTag]
[SyntaxKind.JSDocTypedefTag]: JSDocTypedefTag;
property [SyntaxKind.JSDocTypeExpression]
[SyntaxKind.JSDocTypeExpression]: JSDocTypeExpression;
property [SyntaxKind.JSDocTypeLiteral]
[SyntaxKind.JSDocTypeLiteral]: JSDocTypeLiteral;
property [SyntaxKind.JSDocTypeTag]
[SyntaxKind.JSDocTypeTag]: JSDocTypeTag;
property [SyntaxKind.JSDocUnknownType]
[SyntaxKind.JSDocUnknownType]: JSDocUnknownType;
property [SyntaxKind.JSDocVariadicType]
[SyntaxKind.JSDocVariadicType]: JSDocVariadicType;
property [SyntaxKind.JsxAttribute]
[SyntaxKind.JsxAttribute]: JsxAttribute;
property [SyntaxKind.JsxClosingElement]
[SyntaxKind.JsxClosingElement]: JsxClosingElement;
property [SyntaxKind.JsxClosingFragment]
[SyntaxKind.JsxClosingFragment]: JsxClosingFragment;
property [SyntaxKind.JsxElement]
[SyntaxKind.JsxElement]: JsxElement;
property [SyntaxKind.JsxExpression]
[SyntaxKind.JsxExpression]: JsxExpression;
property [SyntaxKind.JsxFragment]
[SyntaxKind.JsxFragment]: JsxFragment;
property [SyntaxKind.JsxNamespacedName]
[SyntaxKind.JsxNamespacedName]: JsxNamespacedName;
property [SyntaxKind.JsxOpeningElement]
[SyntaxKind.JsxOpeningElement]: JsxOpeningElement;
property [SyntaxKind.JsxOpeningFragment]
[SyntaxKind.JsxOpeningFragment]: JsxOpeningFragment;
property [SyntaxKind.JsxSelfClosingElement]
[SyntaxKind.JsxSelfClosingElement]: JsxSelfClosingElement;
property [SyntaxKind.JsxSpreadAttribute]
[SyntaxKind.JsxSpreadAttribute]: JsxSpreadAttribute;
property [SyntaxKind.JsxText]
[SyntaxKind.JsxText]: JsxText;
property [SyntaxKind.LabeledStatement]
[SyntaxKind.LabeledStatement]: LabeledStatement;
property [SyntaxKind.LiteralType]
[SyntaxKind.LiteralType]: LiteralTypeNode;
property [SyntaxKind.MappedType]
[SyntaxKind.MappedType]: MappedTypeNode;
property [SyntaxKind.MetaProperty]
[SyntaxKind.MetaProperty]: MetaProperty;
property [SyntaxKind.MethodDeclaration]
[SyntaxKind.MethodDeclaration]: MethodDeclaration;
property [SyntaxKind.MethodSignature]
[SyntaxKind.MethodSignature]: MethodSignature;
property [SyntaxKind.ModuleBlock]
[SyntaxKind.ModuleBlock]: ModuleBlock;
property [SyntaxKind.ModuleDeclaration]
[SyntaxKind.ModuleDeclaration]: ModuleDeclaration;
property [SyntaxKind.NamedExports]
[SyntaxKind.NamedExports]: NamedExports;
property [SyntaxKind.NamedImports]
[SyntaxKind.NamedImports]: NamedImports;
property [SyntaxKind.NamedTupleMember]
[SyntaxKind.NamedTupleMember]: NamedTupleMember;
property [SyntaxKind.NamespaceExport]
[SyntaxKind.NamespaceExport]: NamespaceExport;
property [SyntaxKind.NamespaceImport]
[SyntaxKind.NamespaceImport]: NamespaceImport;
property [SyntaxKind.NeverKeyword]
[SyntaxKind.NeverKeyword]: Node<ts.Token<SyntaxKind.NeverKeyword>>;
property [SyntaxKind.NewExpression]
[SyntaxKind.NewExpression]: NewExpression;
property [SyntaxKind.NonNullExpression]
[SyntaxKind.NonNullExpression]: NonNullExpression;
property [SyntaxKind.NoSubstitutionTemplateLiteral]
[SyntaxKind.NoSubstitutionTemplateLiteral]: NoSubstitutionTemplateLiteral;
property [SyntaxKind.NotEmittedStatement]
[SyntaxKind.NotEmittedStatement]: NotEmittedStatement;
property [SyntaxKind.NullKeyword]
[SyntaxKind.NullKeyword]: NullLiteral;
property [SyntaxKind.NumberKeyword]
[SyntaxKind.NumberKeyword]: Expression;
property [SyntaxKind.NumericLiteral]
[SyntaxKind.NumericLiteral]: NumericLiteral;
property [SyntaxKind.ObjectBindingPattern]
[SyntaxKind.ObjectBindingPattern]: ObjectBindingPattern;
property [SyntaxKind.ObjectKeyword]
[SyntaxKind.ObjectKeyword]: Expression;
property [SyntaxKind.ObjectLiteralExpression]
[SyntaxKind.ObjectLiteralExpression]: ObjectLiteralExpression;
property [SyntaxKind.OmittedExpression]
[SyntaxKind.OmittedExpression]: OmittedExpression;
property [SyntaxKind.Parameter]
[SyntaxKind.Parameter]: ParameterDeclaration;
property [SyntaxKind.ParenthesizedExpression]
[SyntaxKind.ParenthesizedExpression]: ParenthesizedExpression;
property [SyntaxKind.ParenthesizedType]
[SyntaxKind.ParenthesizedType]: ParenthesizedTypeNode;
property [SyntaxKind.PartiallyEmittedExpression]
[SyntaxKind.PartiallyEmittedExpression]: PartiallyEmittedExpression;
property [SyntaxKind.PostfixUnaryExpression]
[SyntaxKind.PostfixUnaryExpression]: PostfixUnaryExpression;
property [SyntaxKind.PrefixUnaryExpression]
[SyntaxKind.PrefixUnaryExpression]: PrefixUnaryExpression;
property [SyntaxKind.PrivateIdentifier]
[SyntaxKind.PrivateIdentifier]: PrivateIdentifier;
property [SyntaxKind.PropertyAccessExpression]
[SyntaxKind.PropertyAccessExpression]: PropertyAccessExpression;
property [SyntaxKind.PropertyAssignment]
[SyntaxKind.PropertyAssignment]: PropertyAssignment;
property [SyntaxKind.PropertyDeclaration]
[SyntaxKind.PropertyDeclaration]: PropertyDeclaration;
property [SyntaxKind.PropertySignature]
[SyntaxKind.PropertySignature]: PropertySignature;
property [SyntaxKind.QualifiedName]
[SyntaxKind.QualifiedName]: QualifiedName;
property [SyntaxKind.RegularExpressionLiteral]
[SyntaxKind.RegularExpressionLiteral]: RegularExpressionLiteral;
property [SyntaxKind.RestType]
[SyntaxKind.RestType]: RestTypeNode;
property [SyntaxKind.ReturnStatement]
[SyntaxKind.ReturnStatement]: ReturnStatement;
property [SyntaxKind.SatisfiesExpression]
[SyntaxKind.SatisfiesExpression]: SatisfiesExpression;
property [SyntaxKind.SemicolonToken]
[SyntaxKind.SemicolonToken]: Node<ts.Token<SyntaxKind.SemicolonToken>>;
property [SyntaxKind.SetAccessor]
[SyntaxKind.SetAccessor]: SetAccessorDeclaration;
property [SyntaxKind.ShorthandPropertyAssignment]
[SyntaxKind.ShorthandPropertyAssignment]: ShorthandPropertyAssignment;
property [SyntaxKind.SourceFile]
[SyntaxKind.SourceFile]: SourceFile;
property [SyntaxKind.SpreadAssignment]
[SyntaxKind.SpreadAssignment]: SpreadAssignment;
property [SyntaxKind.SpreadElement]
[SyntaxKind.SpreadElement]: SpreadElement;
property [SyntaxKind.StringKeyword]
[SyntaxKind.StringKeyword]: Expression;
property [SyntaxKind.StringLiteral]
[SyntaxKind.StringLiteral]: StringLiteral;
property [SyntaxKind.SuperKeyword]
[SyntaxKind.SuperKeyword]: SuperExpression;
property [SyntaxKind.SwitchStatement]
[SyntaxKind.SwitchStatement]: SwitchStatement;
property [SyntaxKind.SymbolKeyword]
[SyntaxKind.SymbolKeyword]: Expression;
property [SyntaxKind.SyntaxList]
[SyntaxKind.SyntaxList]: SyntaxList;
property [SyntaxKind.TaggedTemplateExpression]
[SyntaxKind.TaggedTemplateExpression]: TaggedTemplateExpression;
property [SyntaxKind.TemplateExpression]
[SyntaxKind.TemplateExpression]: TemplateExpression;
property [SyntaxKind.TemplateHead]
[SyntaxKind.TemplateHead]: TemplateHead;
property [SyntaxKind.TemplateLiteralType]
[SyntaxKind.TemplateLiteralType]: TemplateLiteralTypeNode;
property [SyntaxKind.TemplateMiddle]
[SyntaxKind.TemplateMiddle]: TemplateMiddle;
property [SyntaxKind.TemplateSpan]
[SyntaxKind.TemplateSpan]: TemplateSpan;
property [SyntaxKind.TemplateTail]
[SyntaxKind.TemplateTail]: TemplateTail;
property [SyntaxKind.ThisKeyword]
[SyntaxKind.ThisKeyword]: ThisExpression;
property [SyntaxKind.ThisType]
[SyntaxKind.ThisType]: ThisTypeNode;
property [SyntaxKind.ThrowStatement]
[SyntaxKind.ThrowStatement]: ThrowStatement;
property [SyntaxKind.TrueKeyword]
[SyntaxKind.TrueKeyword]: TrueLiteral;
property [SyntaxKind.TryStatement]
[SyntaxKind.TryStatement]: TryStatement;
property [SyntaxKind.TupleType]
[SyntaxKind.TupleType]: TupleTypeNode;
property [SyntaxKind.TypeAliasDeclaration]
[SyntaxKind.TypeAliasDeclaration]: TypeAliasDeclaration;
property [SyntaxKind.TypeAssertionExpression]
[SyntaxKind.TypeAssertionExpression]: TypeAssertion;
property [SyntaxKind.TypeLiteral]
[SyntaxKind.TypeLiteral]: TypeLiteralNode;
property [SyntaxKind.TypeOfExpression]
[SyntaxKind.TypeOfExpression]: TypeOfExpression;
property [SyntaxKind.TypeOperator]
[SyntaxKind.TypeOperator]: TypeOperatorTypeNode;
property [SyntaxKind.TypeParameter]
[SyntaxKind.TypeParameter]: TypeParameterDeclaration;
property [SyntaxKind.TypePredicate]
[SyntaxKind.TypePredicate]: TypePredicateNode;
property [SyntaxKind.TypeQuery]
[SyntaxKind.TypeQuery]: TypeQueryNode;
property [SyntaxKind.TypeReference]
[SyntaxKind.TypeReference]: TypeReferenceNode;
property [SyntaxKind.UndefinedKeyword]
[SyntaxKind.UndefinedKeyword]: Expression;
property [SyntaxKind.UnionType]
[SyntaxKind.UnionType]: UnionTypeNode;
property [SyntaxKind.VariableDeclaration]
[SyntaxKind.VariableDeclaration]: VariableDeclaration;
property [SyntaxKind.VariableDeclarationList]
[SyntaxKind.VariableDeclarationList]: VariableDeclarationList;
property [SyntaxKind.VariableStatement]
[SyntaxKind.VariableStatement]: VariableStatement;
property [SyntaxKind.VoidExpression]
[SyntaxKind.VoidExpression]: VoidExpression;
property [SyntaxKind.WhileStatement]
[SyntaxKind.WhileStatement]: WhileStatement;
property [SyntaxKind.WithStatement]
[SyntaxKind.WithStatement]: WithStatement;
property [SyntaxKind.YieldExpression]
[SyntaxKind.YieldExpression]: YieldExpression;
interface ImplementsClauseableNode
interface ImplementsClauseableNode {}
method addImplements
addImplements: { (text: string): ExpressionWithTypeArguments; ( text: WriterFunction | readonly (string | WriterFunction)[] ): ExpressionWithTypeArguments[];};
Adds an implements clause.
Parameter text
Text to add for the implements clause.
Adds multiple implements clauses.
Parameter text
Texts to add for the implements clause.
method getImplements
getImplements: () => ExpressionWithTypeArguments[];
Gets the implements clauses.
method insertImplements
insertImplements: { ( index: number, texts: ReadonlyArray<string | WriterFunction> | WriterFunction ): ExpressionWithTypeArguments[]; (index: number, text: string): ExpressionWithTypeArguments;};
Inserts an implements clause.
Parameter text
Text to insert for the implements clause.
Inserts multiple implements clauses.
Parameter text
Texts to insert for the implements clause.
method removeImplements
removeImplements: { (index: number): this; (implementsNode: ExpressionWithTypeArguments): this;};
Removes the implements at the specified index.
Parameter index
Index to remove.
Removes the specified implements.
Parameter implementsNode
Node of the implements to remove.
interface ImplementsClauseableNodeStructure
interface ImplementsClauseableNodeStructure {}
property implements
implements?: (string | WriterFunction)[] | WriterFunction;
interface ImportAttributeNamedNode
interface ImportAttributeNamedNode extends ImportAttributeNamedNodeSpecific, ReferenceFindableNode, RenameableNode {}
interface ImportAttributeNamedNodeStructure
interface ImportAttributeNamedNodeStructure {}
property name
name: string;
interface ImportAttributeStructure
interface ImportAttributeStructure extends Structure, ImportAttributeStructureSpecificStructure, ImportAttributeNamedNodeStructure {}
interface ImportDeclarationStructure
interface ImportDeclarationStructure extends Structure, ImportDeclarationSpecificStructure {}
interface ImportExpressionedNode
interface ImportExpressionedNode extends BaseExpressionedNode<ImportExpression> {}
interface ImportSpecifierStructure
interface ImportSpecifierStructure extends Structure, ImportSpecifierSpecificStructure {}
interface IndexSignatureDeclarationStructure
interface IndexSignatureDeclarationStructure extends Structure, IndexSignatureDeclarationSpecificStructure, JSDocableNodeStructure, ReadonlyableNodeStructure, ReturnTypedNodeStructure {}
interface InitializerExpressionableNode
interface InitializerExpressionableNode extends InitializerExpressionGetableNode {}
method removeInitializer
removeInitializer: () => this;
Removes the initializer.
method setInitializer
setInitializer: (textOrWriterFunction: string | WriterFunction) => this;
Sets the initializer.
Parameter text
Text or writer function to set for the initializer.
interface InitializerExpressionableNodeStructure
interface InitializerExpressionableNodeStructure {}
property initializer
initializer?: string | WriterFunction;
interface InitializerExpressionGetableNode
interface InitializerExpressionGetableNode {}
method getInitializer
getInitializer: () => Expression | undefined;
Gets the initializer.
method getInitializerIfKind
getInitializerIfKind: <TKind extends SyntaxKind>( kind: TKind) => KindToExpressionMappings[TKind] | undefined;
Gets the initializer if it's a certain kind.
method getInitializerIfKindOrThrow
getInitializerIfKindOrThrow: <TKind extends SyntaxKind>( kind: TKind) => KindToExpressionMappings[TKind];
Gets the initializer if it's a certain kind or throws.
method getInitializerOrThrow
getInitializerOrThrow: (message?: string | (() => string)) => Expression;
Gets the initializer or throw.
method hasInitializer
hasInitializer: () => boolean;
Gets if node has an initializer.
interface InstanceofExpression
interface InstanceofExpression extends BinaryExpression {}
property compilerNode
compilerNode: ts.InstanceofExpression;
method getOperatorToken
getOperatorToken: () => Node<ts.Token<SyntaxKind.InstanceOfKeyword>>;
interface InterfaceDeclarationStructure
interface InterfaceDeclarationStructure extends Structure, NamedNodeStructure, InterfaceDeclarationSpecificStructure, ExtendsClauseableNodeStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure, TypeElementMemberedNodeStructure {}
interface JSDocableNode
interface JSDocableNode {}
method addJsDoc
addJsDoc: ( structure: OptionalKind<JSDocStructure> | string | WriterFunction) => JSDoc;
Adds a JS doc.
Parameter structure
Structure to add.
method addJsDocs
addJsDocs: ( structures: ReadonlyArray< OptionalKind<JSDocStructure> | string | WriterFunction >) => JSDoc[];
Adds JS docs.
Parameter structures
Structures to add.
method getJsDocs
getJsDocs: () => JSDoc[];
Gets the JS doc nodes.
method insertJsDoc
insertJsDoc: ( index: number, structure: OptionalKind<JSDocStructure> | string | WriterFunction) => JSDoc;
Inserts a JS doc.
Parameter index
Child index to insert at.
Parameter structure
Structure to insert.
method insertJsDocs
insertJsDocs: ( index: number, structures: ReadonlyArray< OptionalKind<JSDocStructure> | string | WriterFunction >) => JSDoc[];
Inserts JS docs.
Parameter index
Child index to insert at.
Parameter structures
Structures to insert.
interface JSDocableNodeStructure
interface JSDocableNodeStructure {}
property docs
docs?: (OptionalKind<JSDocStructure> | string)[];
interface JSDocPropertyLikeTag
interface JSDocPropertyLikeTag {}
method getName
getName: () => string;
Gets the name of the JS doc property like tag.
method getNameNode
getNameNode: () => EntityName;
Gets the name node of the JS doc property like tag.
method getTypeExpression
getTypeExpression: () => JSDocTypeExpression | undefined;
Gets the type expression node of the JS doc tag if it exists.
method getTypeExpressionOrThrow
getTypeExpressionOrThrow: ( message?: string | (() => string)) => JSDocTypeExpression;
Gets the type expression node of the JS doc tag or throws if it doesn't exist.
method isBracketed
isBracketed: () => boolean;
Checks if the JS doc property like tag is bracketed.
interface JSDocStructure
interface JSDocStructure extends Structure, JSDocSpecificStructure {}
interface JSDocTagStructure
interface JSDocTagStructure extends Structure, JSDocTagSpecificStructure {}
interface JSDocTypeExpressionableTag
interface JSDocTypeExpressionableTag {}
method getTypeExpression
getTypeExpression: () => JSDocTypeExpression | undefined;
Gets the type expression node of the JS doc tag if it exists.
method getTypeExpressionOrThrow
getTypeExpressionOrThrow: ( message?: string | (() => string)) => JSDocTypeExpression;
Gets the type expression node of the JS doc tag or throws if it doesn't exist.
interface JSDocTypeParameteredTag
interface JSDocTypeParameteredTag {}
method getTypeParameters
getTypeParameters: () => TypeParameterDeclaration[];
Gets the type parameters.
interface JsxAttributedNode
interface JsxAttributedNode {}
method addAttribute
addAttribute: ( attribute: | OptionalKind<JsxAttributeStructure> | OptionalKind<JsxSpreadAttributeStructure>) => JsxAttributeLike;
Adds an attribute into the element.
method addAttributes
addAttributes: ( attributes: ReadonlyArray< | OptionalKind<JsxAttributeStructure> | OptionalKind<JsxSpreadAttributeStructure> >) => JsxAttributeLike[];
Adds attributes into the element.
method getAttribute
getAttribute: { (name: string): JsxAttributeLike | undefined; (findFunction: (attribute: JsxAttributeLike) => boolean): JsxAttributeLike;};
Gets an attribute by name or returns undefined when it can't be found.
Parameter name
Name to search for.
Gets an attribute by a find function or returns undefined when it can't be found.
Parameter findFunction
Find function.
method getAttributeOrThrow
getAttributeOrThrow: { (name: string): JsxAttributeLike; (findFunction: (attribute: JsxAttributeLike) => boolean): JsxAttributeLike;};
Gets an attribute by name or throws when it can't be found.
Parameter name
Name to search for.
Gets an attribute by a find function or throws when it can't be found.
Parameter findFunction
Find function.
method getAttributes
getAttributes: () => JsxAttributeLike[];
Gets the JSX element's attributes.
method insertAttribute
insertAttribute: ( index: number, attribute: | OptionalKind<JsxAttributeStructure> | OptionalKind<JsxSpreadAttributeStructure>) => JsxAttributeLike;
Inserts an attribute into the element.
method insertAttributes
insertAttributes: ( index: number, attributes: ReadonlyArray< | OptionalKind<JsxAttributeStructure> | OptionalKind<JsxSpreadAttributeStructure> >) => JsxAttributeLike[];
Inserts attributes into the element.
interface JsxAttributedNodeStructure
interface JsxAttributedNodeStructure {}
property attributes
attributes?: ( | OptionalKind<JsxAttributeStructure> | JsxSpreadAttributeStructure)[];
interface JsxAttributeStructure
interface JsxAttributeStructure extends Structure, JsxAttributeSpecificStructure {}
interface JsxElementStructure
interface JsxElementStructure extends Structure, JsxElementSpecificStructure {}
interface JsxNamespacedNameStructure
interface JsxNamespacedNameStructure {}
interface JsxSelfClosingElementStructure
interface JsxSelfClosingElementStructure extends Structure, JsxTagNamedNodeStructure, JsxSelfClosingElementSpecificStructure, JsxAttributedNodeStructure {}
interface JsxSpreadAttributeStructure
interface JsxSpreadAttributeStructure extends Structure, JsxSpreadAttributeSpecificStructure {}
interface JsxTagNamedNode
interface JsxTagNamedNode {}
method getTagNameNode
getTagNameNode: () => JsxTagNameExpression;
Gets the tag name of the JSX closing element.
interface JsxTagNamedNodeStructure
interface JsxTagNamedNodeStructure {}
property name
name: string;
interface JsxTagNamePropertyAccess
interface JsxTagNamePropertyAccess extends PropertyAccessExpression {}
method getExpression
getExpression: () => Identifier | ThisExpression | JsxTagNamePropertyAccess;
interface KindedStructure
interface KindedStructure<TKind extends StructureKind> {}
property kind
kind: TKind;
interface KindToExpressionMappings
interface KindToExpressionMappings {}
property [SyntaxKind.AnyKeyword]
[SyntaxKind.AnyKeyword]: Expression;
property [SyntaxKind.ArrayLiteralExpression]
[SyntaxKind.ArrayLiteralExpression]: ArrayLiteralExpression;
property [SyntaxKind.ArrowFunction]
[SyntaxKind.ArrowFunction]: ArrowFunction;
property [SyntaxKind.AsExpression]
[SyntaxKind.AsExpression]: AsExpression;
property [SyntaxKind.AwaitExpression]
[SyntaxKind.AwaitExpression]: AwaitExpression;
property [SyntaxKind.BigIntLiteral]
[SyntaxKind.BigIntLiteral]: BigIntLiteral;
property [SyntaxKind.BinaryExpression]
[SyntaxKind.BinaryExpression]: BinaryExpression;
property [SyntaxKind.BooleanKeyword]
[SyntaxKind.BooleanKeyword]: Expression;
property [SyntaxKind.CallExpression]
[SyntaxKind.CallExpression]: CallExpression;
property [SyntaxKind.ClassExpression]
[SyntaxKind.ClassExpression]: ClassExpression;
property [SyntaxKind.CommaListExpression]
[SyntaxKind.CommaListExpression]: CommaListExpression;
property [SyntaxKind.ConditionalExpression]
[SyntaxKind.ConditionalExpression]: ConditionalExpression;
property [SyntaxKind.DeleteExpression]
[SyntaxKind.DeleteExpression]: DeleteExpression;
property [SyntaxKind.ElementAccessExpression]
[SyntaxKind.ElementAccessExpression]: ElementAccessExpression;
property [SyntaxKind.FalseKeyword]
[SyntaxKind.FalseKeyword]: FalseLiteral;
property [SyntaxKind.FunctionExpression]
[SyntaxKind.FunctionExpression]: FunctionExpression;
property [SyntaxKind.Identifier]
[SyntaxKind.Identifier]: Identifier;
property [SyntaxKind.ImportKeyword]
[SyntaxKind.ImportKeyword]: ImportExpression;
property [SyntaxKind.JsxClosingFragment]
[SyntaxKind.JsxClosingFragment]: JsxClosingFragment;
property [SyntaxKind.JsxElement]
[SyntaxKind.JsxElement]: JsxElement;
property [SyntaxKind.JsxExpression]
[SyntaxKind.JsxExpression]: JsxExpression;
property [SyntaxKind.JsxFragment]
[SyntaxKind.JsxFragment]: JsxFragment;
property [SyntaxKind.JsxOpeningElement]
[SyntaxKind.JsxOpeningElement]: JsxOpeningElement;
property [SyntaxKind.JsxOpeningFragment]
[SyntaxKind.JsxOpeningFragment]: JsxOpeningFragment;
property [SyntaxKind.JsxSelfClosingElement]
[SyntaxKind.JsxSelfClosingElement]: JsxSelfClosingElement;
property [SyntaxKind.MetaProperty]
[SyntaxKind.MetaProperty]: MetaProperty;
property [SyntaxKind.NewExpression]
[SyntaxKind.NewExpression]: NewExpression;
property [SyntaxKind.NonNullExpression]
[SyntaxKind.NonNullExpression]: NonNullExpression;
property [SyntaxKind.NoSubstitutionTemplateLiteral]
[SyntaxKind.NoSubstitutionTemplateLiteral]: NoSubstitutionTemplateLiteral;
property [SyntaxKind.NullKeyword]
[SyntaxKind.NullKeyword]: NullLiteral;
property [SyntaxKind.NumberKeyword]
[SyntaxKind.NumberKeyword]: Expression;
property [SyntaxKind.NumericLiteral]
[SyntaxKind.NumericLiteral]: NumericLiteral;
property [SyntaxKind.ObjectKeyword]
[SyntaxKind.ObjectKeyword]: Expression;
property [SyntaxKind.ObjectLiteralExpression]
[SyntaxKind.ObjectLiteralExpression]: ObjectLiteralExpression;
property [SyntaxKind.OmittedExpression]
[SyntaxKind.OmittedExpression]: OmittedExpression;
property [SyntaxKind.ParenthesizedExpression]
[SyntaxKind.ParenthesizedExpression]: ParenthesizedExpression;
property [SyntaxKind.PartiallyEmittedExpression]
[SyntaxKind.PartiallyEmittedExpression]: PartiallyEmittedExpression;
property [SyntaxKind.PostfixUnaryExpression]
[SyntaxKind.PostfixUnaryExpression]: PostfixUnaryExpression;
property [SyntaxKind.PrefixUnaryExpression]
[SyntaxKind.PrefixUnaryExpression]: PrefixUnaryExpression;
property [SyntaxKind.PropertyAccessExpression]
[SyntaxKind.PropertyAccessExpression]: PropertyAccessExpression;
property [SyntaxKind.RegularExpressionLiteral]
[SyntaxKind.RegularExpressionLiteral]: RegularExpressionLiteral;
property [SyntaxKind.SatisfiesExpression]
[SyntaxKind.SatisfiesExpression]: SatisfiesExpression;
property [SyntaxKind.SpreadElement]
[SyntaxKind.SpreadElement]: SpreadElement;
property [SyntaxKind.StringKeyword]
[SyntaxKind.StringKeyword]: Expression;
property [SyntaxKind.StringLiteral]
[SyntaxKind.StringLiteral]: StringLiteral;
property [SyntaxKind.SuperKeyword]
[SyntaxKind.SuperKeyword]: SuperExpression;
property [SyntaxKind.SymbolKeyword]
[SyntaxKind.SymbolKeyword]: Expression;
property [SyntaxKind.TaggedTemplateExpression]
[SyntaxKind.TaggedTemplateExpression]: TaggedTemplateExpression;
property [SyntaxKind.TemplateExpression]
[SyntaxKind.TemplateExpression]: TemplateExpression;
property [SyntaxKind.ThisKeyword]
[SyntaxKind.ThisKeyword]: ThisExpression;
property [SyntaxKind.TrueKeyword]
[SyntaxKind.TrueKeyword]: TrueLiteral;
property [SyntaxKind.TypeAssertionExpression]
[SyntaxKind.TypeAssertionExpression]: TypeAssertion;
property [SyntaxKind.TypeOfExpression]
[SyntaxKind.TypeOfExpression]: TypeOfExpression;
property [SyntaxKind.UndefinedKeyword]
[SyntaxKind.UndefinedKeyword]: Expression;
property [SyntaxKind.VoidExpression]
[SyntaxKind.VoidExpression]: VoidExpression;
property [SyntaxKind.YieldExpression]
[SyntaxKind.YieldExpression]: YieldExpression;
index signature
[kind: number]: Node;
interface KindToNodeMappings
interface KindToNodeMappings extends ImplementedKindToNodeMappings {}
index signature
[kind: number]: Node;
interface KindToNodeMappingsWithCommentStatements
interface KindToNodeMappingsWithCommentStatements extends ImplementedKindToNodeMappings {}
property [SyntaxKind.MultiLineCommentTrivia]
[SyntaxKind.MultiLineCommentTrivia]: CommentStatement;
property [SyntaxKind.SingleLineCommentTrivia]
[SyntaxKind.SingleLineCommentTrivia]: CommentStatement;
index signature
[kind: number]: Node;
interface LeftHandSideExpressionedNode
interface LeftHandSideExpressionedNode extends BaseExpressionedNode<LeftHandSideExpression> {}
interface LiteralLikeNode
interface LiteralLikeNode {}
method getLiteralText
getLiteralText: () => string;
Get text of the literal.
method hasExtendedUnicodeEscape
hasExtendedUnicodeEscape: () => boolean;
Gets if the literal has an extended unicode escape.
method isTerminated
isTerminated: () => boolean;
Gets if the literal is terminated.
interface ManipulationSettings
interface ManipulationSettings extends SupportedFormatCodeSettingsOnly {}
Manipulation settings.
property indentationText
indentationText: IndentationText;
Indentation text
property newLineKind
newLineKind: NewLineKind;
New line kind
property quoteKind
quoteKind: QuoteKind;
Quote type used for string literals.
property usePrefixAndSuffixTextForRename
usePrefixAndSuffixTextForRename: boolean;
Whether to enable renaming shorthand property assignments, binding elements, and import & export specifiers without changing behaviour.
Remarks
Defaults to true. This setting is only available when using TypeScript 3.4+.
property useTrailingCommas
useTrailingCommas: boolean;
Whether to use trailing commas when inserting or removing nodes.
interface MemoryEmitResultFile
interface MemoryEmitResultFile {}
The emitted file in memory.
property filePath
filePath: StandardizedFilePath;
File path that was emitted to.
property text
text: string;
The text that was emitted.
property writeByteOrderMark
writeByteOrderMark: boolean;
Whether the byte order mark should be written.
interface MethodDeclarationOverloadStructure
interface MethodDeclarationOverloadStructure extends Structure, MethodDeclarationOverloadSpecificStructure, StaticableNodeStructure, AbstractableNodeStructure, ScopedNodeStructure, AsyncableNodeStructure, GeneratorableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, QuestionTokenableNodeStructure, OverrideableNodeStructure {}
interface MethodDeclarationStructure
interface MethodDeclarationStructure extends Structure, MethodDeclarationSpecificStructure, PropertyNamedNodeStructure, StaticableNodeStructure, DecoratableNodeStructure, AbstractableNodeStructure, ScopedNodeStructure, AsyncableNodeStructure, GeneratorableNodeStructure, FunctionLikeDeclarationStructure, QuestionTokenableNodeStructure, OverrideableNodeStructure {}
interface MethodSignatureStructure
interface MethodSignatureStructure extends Structure, PropertyNamedNodeStructure, MethodSignatureSpecificStructure, QuestionTokenableNodeStructure, JSDocableNodeStructure, SignaturedDeclarationStructure, TypeParameteredNodeStructure {}
interface ModifierableNode
interface ModifierableNode {}
method getFirstModifierByKind
getFirstModifierByKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind] | undefined;
Gets the first modifier of the specified syntax kind or undefined if none found.
Parameter kind
Syntax kind.
method getFirstModifierByKindOrThrow
getFirstModifierByKindOrThrow: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappings[TKind];
Gets the first modifier of the specified syntax kind or throws if none found.
Parameter kind
Syntax kind.
method getModifiers
getModifiers: () => Node<ts.Modifier>[];
Gets the node's modifiers.
method hasModifier
hasModifier: { (kind: SyntaxKind): boolean; (text: ModifierTexts): boolean };
Gets if it has the specified modifier.
Parameter kind
Syntax kind to check for.
Gets if it has the specified modifier.
Parameter text
Text to check for.
method toggleModifier
toggleModifier: (text: ModifierTexts, value?: boolean) => this;
Toggles a modifier.
Parameter text
Text to toggle the modifier for.
Parameter value
Optional toggling value.
interface ModuleChildableNode
interface ModuleChildableNode {}
method getParentModule
getParentModule: () => ModuleDeclaration | undefined;
Gets the parent module declaration or undefined if it doesn't exist.
method getParentModuleOrThrow
getParentModuleOrThrow: (message?: string | (() => string)) => ModuleDeclaration;
Gets the parent module declaration or throws if it doesn't exist.
interface ModuleDeclarationStructure
interface ModuleDeclarationStructure extends Structure, ModuleNamedNodeStructure, ModuleDeclarationSpecificStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure, StatementedNodeStructure {}
interface ModuledNode
interface ModuledNode {}
method addExportAssignment
addExportAssignment: ( structure: OptionalKind<ExportAssignmentStructure>) => ExportAssignment;
Add export assignments.
Parameter structure
Structure that represents the export.
method addExportAssignments
addExportAssignments: ( structures: ReadonlyArray<OptionalKind<ExportAssignmentStructure>>) => ExportAssignment[];
Add export assignments.
Parameter structures
Structures that represent the exports.
method addExportDeclaration
addExportDeclaration: ( structure: OptionalKind<ExportDeclarationStructure>) => ExportDeclaration;
Add export declarations.
Parameter structure
Structure that represents the export.
method addExportDeclarations
addExportDeclarations: ( structures: ReadonlyArray<OptionalKind<ExportDeclarationStructure>>) => ExportDeclaration[];
Add export declarations.
Parameter structures
Structures that represent the exports.
method addImportDeclaration
addImportDeclaration: ( structure: OptionalKind<ImportDeclarationStructure>) => ImportDeclaration;
Adds an import.
Parameter structure
Structure that represents the import.
method addImportDeclarations
addImportDeclarations: ( structures: ReadonlyArray<OptionalKind<ImportDeclarationStructure>>) => ImportDeclaration[];
Adds imports.
Parameter structures
Structures that represent the imports.
method getDefaultExportSymbol
getDefaultExportSymbol: () => Symbol | undefined;
Gets the default export symbol.
method getDefaultExportSymbolOrThrow
getDefaultExportSymbolOrThrow: (message?: string | (() => string)) => Symbol;
Gets the default export symbol or throws if it doesn't exist.
method getExportAssignment
getExportAssignment: ( condition: (exportAssignment: ExportAssignment) => boolean) => ExportAssignment | undefined;
Gets the first export assignment that matches a condition, or undefined if it doesn't exist.
Parameter condition
Condition to get the export assignment by.
method getExportAssignmentOrThrow
getExportAssignmentOrThrow: ( condition: (exportAssignment: ExportAssignment) => boolean, message?: string | (() => string)) => ExportAssignment;
Gets the first export assignment that matches a condition, or throws if it doesn't exist.
Parameter condition
Condition to get the export assignment by.
method getExportAssignments
getExportAssignments: () => ExportAssignment[];
Get the file's export assignments.
method getExportDeclaration
getExportDeclaration: { ( condition: (exportDeclaration: ExportDeclaration) => boolean, message?: string | (() => string) ): ExportDeclaration | undefined; (moduleSpecifier: string): ExportDeclaration;};
Gets the first export declaration that matches a module specifier, or undefined if it doesn't exist.
Parameter module
Module specifier to get the export declaration by.
method getExportDeclarationOrThrow
getExportDeclarationOrThrow: { ( condition: (exportDeclaration: ExportDeclaration) => boolean, message?: string | (() => string) ): ExportDeclaration; ( moduleSpecifier: string, message?: string | (() => string) ): ExportDeclaration;};
Gets the first export declaration that matches a condition, or throws if it doesn't exist.
Parameter condition
Condition to get the export declaration by.
Gets the first export declaration that matches a module specifier, or throws if it doesn't exist.
Parameter module
Module specifier to get the export declaration by.
method getExportDeclarations
getExportDeclarations: () => ExportDeclaration[];
Get the export declarations.
method getExportedDeclarations
getExportedDeclarations: () => ReadonlyMap<string, ExportedDeclarations[]>;
Gets all the declarations that are exported from the module.
The key is the name it's exported on and the value is the array of declarations for that name.
This will include declarations that are transitively exported from other modules. If you mean to get the export declarations then use
.getExportDeclarations()
.
method getExportSymbols
getExportSymbols: () => Symbol[];
Gets the export symbols.
method getImportDeclaration
getImportDeclaration: { (condition: (importDeclaration: ImportDeclaration) => boolean): | ImportDeclaration | undefined; (moduleSpecifier: string): ImportDeclaration;};
Gets the first import declaration that matches a condition, or undefined if it doesn't exist.
Parameter condition
Condition to get the import declaration by.
Gets the first import declaration that matches a module specifier, or undefined if it doesn't exist.
Parameter module
Module specifier to get the import declaration by.
method getImportDeclarationOrThrow
getImportDeclarationOrThrow: { ( condition: (importDeclaration: ImportDeclaration) => boolean ): ImportDeclaration; (moduleSpecifier: string): ImportDeclaration;};
Gets the first import declaration that matches a condition, or throws if it doesn't exist.
Parameter condition
Condition to get the import declaration by.
Gets the first import declaration that matches a module specifier, or throws if it doesn't exist.
Parameter module
Module specifier to get the import declaration by.
method getImportDeclarations
getImportDeclarations: () => ImportDeclaration[];
Get the module's import declarations.
method insertExportAssignment
insertExportAssignment: ( index: number, structure: OptionalKind<ExportAssignmentStructure>) => ExportAssignment;
Insert an export assignment.
Parameter index
Child index to insert at.
Parameter structure
Structure that represents the export.
method insertExportAssignments
insertExportAssignments: ( index: number, structures: ReadonlyArray<OptionalKind<ExportAssignmentStructure>>) => ExportAssignment[];
Insert export assignments into a file.
Parameter index
Child index to insert at.
Parameter structures
Structures that represent the exports to insert.
method insertExportDeclaration
insertExportDeclaration: ( index: number, structure: OptionalKind<ExportDeclarationStructure>) => ExportDeclaration;
Insert an export declaration.
Parameter index
Child index to insert at.
Parameter structure
Structure that represents the export.
method insertExportDeclarations
insertExportDeclarations: ( index: number, structures: ReadonlyArray<OptionalKind<ExportDeclarationStructure>>) => ExportDeclaration[];
Insert export declarations.
Parameter index
Child index to insert at.
Parameter structures
Structures that represent the exports to insert.
method insertImportDeclaration
insertImportDeclaration: ( index: number, structure: OptionalKind<ImportDeclarationStructure>) => ImportDeclaration;
Insert an import.
Parameter index
Child index to insert at.
Parameter structure
Structure that represents the import.
method insertImportDeclarations
insertImportDeclarations: ( index: number, structures: ReadonlyArray<OptionalKind<ImportDeclarationStructure>>) => ImportDeclaration[];
Inserts imports.
Parameter index
Child index to insert at.
Parameter structures
Structures that represent the imports to insert.
method removeDefaultExport
removeDefaultExport: (defaultExportSymbol?: Symbol | undefined) => this;
Removes any "export default".
interface ModuleNamedNode
interface ModuleNamedNode extends ModuleNamedNodeSpecific, ReferenceFindableNode, RenameableNode {}
interface ModuleNamedNodeStructure
interface ModuleNamedNodeStructure {}
property name
name: string;
interface NameableNode
interface NameableNode extends NameableNodeSpecific, ReferenceFindableNode, RenameableNode {}
interface NameableNodeSpecific
interface NameableNodeSpecific {}
method getName
getName: () => string | undefined;
Gets the name if it exists.
method getNameNode
getNameNode: () => Identifier | undefined;
Gets the name node if it exists.
method getNameNodeOrThrow
getNameNodeOrThrow: (message?: string | (() => string)) => Identifier;
Gets the name node if it exists, or throws.
method getNameOrThrow
getNameOrThrow: (message?: string | (() => string)) => string;
Gets the name if it exists, or throws.
method removeName
removeName: () => this;
Removes the name from the node.
interface NameableNodeStructure
interface NameableNodeStructure {}
property name
name?: string;
interface NamedNode
interface NamedNode extends NamedNodeSpecific, ReferenceFindableNode, RenameableNode {}
interface NamedNodeSpecificBase
interface NamedNodeSpecificBase<TNode extends Node> {}
method getName
getName: () => string;
Gets the name as a string.
method getNameNode
getNameNode: () => TNode;
Gets the name node.
interface NamedNodeStructure
interface NamedNodeStructure {}
property name
name: string;
interface OverloadableNode
interface OverloadableNode {}
Node that supports overloads.
method getImplementation
getImplementation: () => this | undefined;
Gets the implementation or undefined if it doesn't exist.
method getImplementationOrThrow
getImplementationOrThrow: (message?: string | (() => string)) => this;
Gets the implementation or throws if it doesn't exist.
method getOverloads
getOverloads: () => this[];
Gets all the overloads associated with this node.
method isImplementation
isImplementation: () => boolean;
Gets if this is the implementation.
method isOverload
isOverload: () => boolean;
Gets if this is not the implementation.
interface OverrideableNode
interface OverrideableNode {}
method getOverrideKeyword
getOverrideKeyword: () => Node<ts.OverrideKeyword> | undefined;
Gets the override keyword or undefined if none exists.
method getOverrideKeywordOrThrow
getOverrideKeywordOrThrow: ( message?: string | (() => string)) => Node<ts.Modifier>;
Gets the override keyword or throws if none exists.
method hasOverrideKeyword
hasOverrideKeyword: () => boolean;
If it has an override keyword.
method setHasOverrideKeyword
setHasOverrideKeyword: (value: boolean) => this;
Sets if the node has an override keyword.
Parameter value
If it should have an override keyword or not.
interface OverrideableNodeStructure
interface OverrideableNodeStructure {}
property hasOverrideKeyword
hasOverrideKeyword?: boolean;
interface ParameterDeclarationStructure
interface ParameterDeclarationStructure extends Structure, BindingNamedNodeStructure, TypedNodeStructure, ReadonlyableNodeStructure, DecoratableNodeStructure, QuestionTokenableNodeStructure, ScopeableNodeStructure, InitializerExpressionableNodeStructure, ParameterDeclarationSpecificStructure, OverrideableNodeStructure {}
interface ParameteredNode
interface ParameteredNode {}
method addParameter
addParameter: ( structure: OptionalKind<ParameterDeclarationStructure>) => ParameterDeclaration;
Adds a parameter.
Parameter structure
Structure of the parameter.
method addParameters
addParameters: ( structures: ReadonlyArray<OptionalKind<ParameterDeclarationStructure>>) => ParameterDeclaration[];
Adds parameters.
Parameter structures
Structures of the parameters.
method getParameter
getParameter: { (name: string): ParameterDeclaration | undefined; ( findFunction: (declaration: ParameterDeclaration) => boolean ): ParameterDeclaration;};
Gets a parameter or undefined if it doesn't exist.
Parameter name
Name of the parameter.
Gets a parameter or undefined if it doesn't exist.
Parameter findFunction
Function to use to find the parameter.
method getParameterOrThrow
getParameterOrThrow: { (name: string): ParameterDeclaration; ( findFunction: (declaration: ParameterDeclaration) => boolean ): ParameterDeclaration;};
Gets a parameter or throws if it doesn't exist.
Parameter name
Name of the parameter.
Gets a parameter or throws if it doesn't exist.
Parameter findFunction
Function to use to find the parameter.
method getParameters
getParameters: () => ParameterDeclaration[];
Gets all the parameters of the node.
method insertParameter
insertParameter: ( index: number, structure: OptionalKind<ParameterDeclarationStructure>) => ParameterDeclaration;
Inserts a parameter.
Parameter index
Child index to insert at.
Parameter structures
Parameter to insert.
method insertParameters
insertParameters: ( index: number, structures: ReadonlyArray<OptionalKind<ParameterDeclarationStructure>>) => ParameterDeclaration[];
Inserts parameters.
Parameter index
Child index to insert at.
Parameter structures
Parameters to insert.
interface ParameteredNodeStructure
interface ParameteredNodeStructure {}
property parameters
parameters?: OptionalKind<ParameterDeclarationStructure>[];
interface PrintNodeOptions
interface PrintNodeOptions {}
Options for printing a node.
property emitHint
emitHint?: EmitHint;
From the compiler api: "A value indicating the purpose of a node. This is primarily used to distinguish between an
Identifier
used in an expression position, versus anIdentifier
used as anIdentifierName
as part of a declaration. For most nodes you should just passUnspecified
."Defaults to
Unspecified
.
property newLineKind
newLineKind?: NewLineKind;
New line kind.
Defaults to line feed.
property removeComments
removeComments?: boolean;
Whether to remove comments or not.
property scriptKind
scriptKind?: ScriptKind;
The script kind.
Remarks
This is only useful when passing in a compiler node that was constructed with the compiler API factory methods.
Defaults to TSX.
interface ProgramEmitOptions
interface ProgramEmitOptions extends EmitOptions {}
Options for emitting from a Program.
property writeFile
writeFile?: ts.WriteFileCallback;
interface ProjectOptions
interface ProjectOptions {}
Options for creating a project.
property compilerOptions
compilerOptions?: CompilerOptions;
Compiler options
property defaultCompilerOptions
defaultCompilerOptions?: CompilerOptions;
Can be overriden by
tsConfigFilePath
orcompilerOptions
.
property fileSystem
fileSystem?: FileSystemHost;
Optional file system host. Useful for mocking access to the file system.
Remarks
Consider using
useInMemoryFileSystem
instead.
property libFolderPath
libFolderPath?: string;
The folder to use for loading lib files.
property manipulationSettings
manipulationSettings?: Partial<ManipulationSettings>;
Manipulation settings
property resolutionHost
resolutionHost?: ResolutionHostFactory;
Creates a resolution host for specifying custom module and/or type reference directive resolution.
property skipAddingFilesFromTsConfig
skipAddingFilesFromTsConfig?: boolean;
Whether to skip adding the source files from the specified tsconfig.json. false
property skipFileDependencyResolution
skipFileDependencyResolution?: boolean;
Skip resolving file dependencies when providing a ts config file path and adding the files from tsconfig. false
property skipLoadingLibFiles
skipLoadingLibFiles?: boolean;
Skip loading the lib files. Unlike the compiler API, ts-morph does not load these from the node_modules folder, but instead loads them from some other JS code and uses a fake path for their existence. If you want to use a custom lib files folder path, then provide one using the libFolderPath options. false
property tsConfigFilePath
tsConfigFilePath?: string;
File path to the tsconfig.json file.
property useInMemoryFileSystem
useInMemoryFileSystem?: boolean;
Whether to use an in-memory file system. false
interface PropertyAssignmentStructure
interface PropertyAssignmentStructure extends Structure, PropertyAssignmentSpecificStructure, PropertyNamedNodeStructure {}
interface PropertyDeclarationStructure
interface PropertyDeclarationStructure extends Structure, PropertyDeclarationSpecificStructure, PropertyNamedNodeStructure, TypedNodeStructure, QuestionTokenableNodeStructure, ExclamationTokenableNodeStructure, StaticableNodeStructure, ScopedNodeStructure, JSDocableNodeStructure, ReadonlyableNodeStructure, InitializerExpressionableNodeStructure, DecoratableNodeStructure, AbstractableNodeStructure, AmbientableNodeStructure, OverrideableNodeStructure {}
interface PropertyNameableNodeStructure
interface PropertyNameableNodeStructure {}
property name
name?: string;
interface PropertyNamedNode
interface PropertyNamedNode extends PropertyNamedNodeSpecific, ReferenceFindableNode, RenameableNode {}
interface PropertyNamedNodeStructure
interface PropertyNamedNodeStructure {}
property name
name: string;
interface PropertySignatureStructure
interface PropertySignatureStructure extends Structure, PropertySignatureSpecificStructure, PropertyNamedNodeStructure, TypedNodeStructure, QuestionTokenableNodeStructure, JSDocableNodeStructure, ReadonlyableNodeStructure, InitializerExpressionableNodeStructure {}
interface QuestionDotTokenableNode
interface QuestionDotTokenableNode {}
method getQuestionDotTokenNode
getQuestionDotTokenNode: () => Node<ts.QuestionDotToken> | undefined;
Gets the question dot token node or returns undefined if it doesn't exist.
method getQuestionDotTokenNodeOrThrow
getQuestionDotTokenNodeOrThrow: ( message?: string | (() => string)) => Node<ts.QuestionDotToken>;
Gets the question dot token node or throws.
method hasQuestionDotToken
hasQuestionDotToken: () => boolean;
If it has a question dot token.
method setHasQuestionDotToken
setHasQuestionDotToken: (value: boolean) => this;
Sets if this node has a question dot token.
Parameter value
If it should have a question dot token or not.
interface QuestionDotTokenableNodeStructure
interface QuestionDotTokenableNodeStructure {}
property hasQuestionDotToken
hasQuestionDotToken?: boolean;
interface QuestionTokenableNode
interface QuestionTokenableNode {}
method getQuestionTokenNode
getQuestionTokenNode: () => Node<ts.QuestionToken> | undefined;
Gets the question token node or returns undefined if it doesn't exist.
method getQuestionTokenNodeOrThrow
getQuestionTokenNodeOrThrow: ( message?: string | (() => string)) => Node<ts.QuestionToken>;
Gets the question token node or throws.
method hasQuestionToken
hasQuestionToken: () => boolean;
If it has a question token.
method setHasQuestionToken
setHasQuestionToken: (value: boolean) => this;
Sets if this node has a question token.
Parameter value
If it should have a question token or not.
interface QuestionTokenableNodeStructure
interface QuestionTokenableNodeStructure {}
property hasQuestionToken
hasQuestionToken?: boolean;
interface ReadonlyableNode
interface ReadonlyableNode {}
method getReadonlyKeyword
getReadonlyKeyword: () => Node | undefined;
Gets the readonly keyword, or undefined if none exists.
method getReadonlyKeywordOrThrow
getReadonlyKeywordOrThrow: (message?: string | (() => string)) => Node;
Gets the readonly keyword, or throws if none exists.
method isReadonly
isReadonly: () => boolean;
Gets if it's readonly.
method setIsReadonly
setIsReadonly: (value: boolean) => this;
Sets if this node is readonly.
Parameter value
If readonly or not.
interface ReadonlyableNodeStructure
interface ReadonlyableNodeStructure {}
property isReadonly
isReadonly?: boolean;
interface ReferenceFindableNode
interface ReferenceFindableNode {}
method findReferences
findReferences: () => ReferencedSymbol[];
Finds the references of the definition of the node.
method findReferencesAsNodes
findReferencesAsNodes: () => Node[];
Finds the nodes that reference the definition of the node.
interface RenameableNode
interface RenameableNode {}
method rename
rename: (newName: string, options?: RenameOptions) => this;
Renames the name of the node.
Parameter newName
New name.
Parameter options
Options for renaming.
interface RenameOptions
interface RenameOptions {}
Options for renaming a node.
property renameInComments
renameInComments?: boolean;
Whether comments referencing this node should be renamed.
Remarks
False by default.
property renameInStrings
renameInStrings?: boolean;
Whether strings referencing this node should be renamed.
Remarks
False by default.
property usePrefixAndSuffixText
usePrefixAndSuffixText?: boolean;
Whether to enable renaming shorthand property assignments, binding elements, and import & export specifiers without changing behaviour.
Remarks
Defaults to the
usePrefixAndSuffixTextForRename
manipulation setting. This setting is only available when using TypeScript 3.4+.
interface ResolutionHost
interface ResolutionHost {}
Host for implementing custom module and/or type reference directive resolution.
property getResolvedModuleWithFailedLookupLocationsFromCache
getResolvedModuleWithFailedLookupLocationsFromCache?: ts.LanguageServiceHost['getResolvedModuleWithFailedLookupLocationsFromCache'];
property resolveModuleNames
resolveModuleNames?: ts.LanguageServiceHost['resolveModuleNames'];
property resolveTypeReferenceDirectives
resolveTypeReferenceDirectives?: ts.LanguageServiceHost['resolveTypeReferenceDirectives'];
interface ReturnTypedNode
interface ReturnTypedNode {}
method getReturnType
getReturnType: () => Type;
Gets the return type.
method getReturnTypeNode
getReturnTypeNode: () => TypeNode | undefined;
Gets the return type node or undefined if none exists.
method getReturnTypeNodeOrThrow
getReturnTypeNodeOrThrow: (message?: string | (() => string)) => TypeNode;
Gets the return type node or throws if none exists.
method getSignature
getSignature: () => Signature;
Gets the signature of the node from the type checker.
method removeReturnType
removeReturnType: () => this;
Removes the return type.
method setReturnType
setReturnType: (textOrWriterFunction: string | WriterFunction) => this;
Sets the return type of the node.
Parameter textOrWriterFunction
Text or writer function to set the return type with.
interface ReturnTypedNodeStructure
interface ReturnTypedNodeStructure {}
property returnType
returnType?: string | WriterFunction;
interface RuntimeDirEntry
interface RuntimeDirEntry {}
property isDirectory
isDirectory: boolean;
property isFile
isFile: boolean;
property isSymlink
isSymlink: boolean;
property name
name: string;
interface ScopeableNode
interface ScopeableNode {}
method getScope
getScope: () => Scope | undefined;
Gets the scope.
method hasScopeKeyword
hasScopeKeyword: () => boolean;
Gets if the node has a scope keyword.
method setScope
setScope: (scope: Scope | undefined) => this;
Sets the scope.
Parameter scope
Scope to set to.
interface ScopeableNodeStructure
interface ScopeableNodeStructure {}
property scope
scope?: Scope;
interface ScopedNode
interface ScopedNode {}
method getScope
getScope: () => Scope;
Gets the scope.
method hasScopeKeyword
hasScopeKeyword: () => boolean;
Gets if the node has a scope keyword.
method setScope
setScope: (scope: Scope | undefined) => this;
Sets the scope.
Parameter scope
Scope to set to.
interface ScopedNodeStructure
interface ScopedNodeStructure {}
property scope
scope?: Scope;
interface SetAccessorDeclarationStructure
interface SetAccessorDeclarationStructure extends Structure, SetAccessorDeclarationSpecificStructure, PropertyNamedNodeStructure, StaticableNodeStructure, DecoratableNodeStructure, AbstractableNodeStructure, ScopedNodeStructure, FunctionLikeDeclarationStructure {}
interface ShorthandPropertyAssignmentStructure
interface ShorthandPropertyAssignmentStructure extends Structure, ShorthandPropertyAssignmentSpecificStructure, NamedNodeStructure {}
interface SignaturedDeclaration
interface SignaturedDeclaration extends ParameteredNode, ReturnTypedNode {}
interface SignaturedDeclarationStructure
interface SignaturedDeclarationStructure extends ParameteredNodeStructure, ReturnTypedNodeStructure {}
interface SourceFileCopyOptions
interface SourceFileCopyOptions {}
property overwrite
overwrite?: boolean;
interface SourceFileCreateOptions
interface SourceFileCreateOptions {}
Options for creating a source file.
property overwrite
overwrite?: boolean;
Whether a source file should be overwritten if it exists. Defaults to false.
Remarks
When false, the method will throw when a file exists.
property scriptKind
scriptKind?: ScriptKind;
Specifies the script kind of the source file.
interface SourceFileEmitOptions
interface SourceFileEmitOptions extends EmitOptionsBase {}
Options for emitting a source file.
interface SourceFileMoveOptions
interface SourceFileMoveOptions {}
property overwrite
overwrite?: boolean;
interface SourceFileStructure
interface SourceFileStructure extends Structure, SourceFileSpecificStructure, StatementedNodeStructure {}
interface SpreadAssignmentStructure
interface SpreadAssignmentStructure extends Structure, SpreadAssignmentSpecificStructure, ExpressionedNodeStructure {}
interface StatementedNode
interface StatementedNode {}
method addClass
addClass: ( structure: OptionalKind<ClassDeclarationStructure>) => ClassDeclaration;
Adds an class declaration as a child.
Parameter structure
Structure of the class declaration to add.
method addClasses
addClasses: ( structures: ReadonlyArray<OptionalKind<ClassDeclarationStructure>>) => ClassDeclaration[];
Adds class declarations as a child.
Parameter structures
Structures of the class declarations to add.
method addEnum
addEnum: (structure: OptionalKind<EnumDeclarationStructure>) => EnumDeclaration;
Adds an enum declaration as a child.
Parameter structure
Structure of the enum declaration to add.
method addEnums
addEnums: ( structures: ReadonlyArray<OptionalKind<EnumDeclarationStructure>>) => EnumDeclaration[];
Adds enum declarations as a child.
Parameter structures
Structures of the enum declarations to add.
method addFunction
addFunction: ( structure: OptionalKind<FunctionDeclarationStructure>) => FunctionDeclaration;
Adds a function declaration as a child.
Parameter structure
Structure of the function declaration to add.
method addFunctions
addFunctions: ( structures: ReadonlyArray<OptionalKind<FunctionDeclarationStructure>>) => FunctionDeclaration[];
Adds function declarations as a child.
Parameter structures
Structures of the function declarations to add.
method addInterface
addInterface: ( structure: OptionalKind<InterfaceDeclarationStructure>) => InterfaceDeclaration;
Adds a interface declaration as a child.
Parameter structure
Structure of the interface declaration to add.
method addInterfaces
addInterfaces: ( structures: ReadonlyArray<OptionalKind<InterfaceDeclarationStructure>>) => InterfaceDeclaration[];
Adds interface declarations as a child.
Parameter structures
Structures of the interface declarations to add.
method addModule
addModule: ( structure: OptionalKind<ModuleDeclarationStructure>) => ModuleDeclaration;
Adds a module declaration as a child.
Parameter structure
Structure of the namespace declaration to add.
method addModules
addModules: ( structures: ReadonlyArray<OptionalKind<ModuleDeclarationStructure>>) => ModuleDeclaration[];
Adds module declarations as a child.
Parameter structures
Structures of the namespace declarations to add.
method addStatements
addStatements: ( statements: | string | WriterFunction | ReadonlyArray<string | WriterFunction | StatementStructures>) => Statement[];
Add statements.
Parameter statements
statements to add.
Returns
The statements that were added.
method addTypeAlias
addTypeAlias: ( structure: OptionalKind<TypeAliasDeclarationStructure>) => TypeAliasDeclaration;
Adds a type alias declaration as a child.
Parameter structure
Structure of the type alias declaration to add.
method addTypeAliases
addTypeAliases: ( structures: ReadonlyArray<OptionalKind<TypeAliasDeclarationStructure>>) => TypeAliasDeclaration[];
Adds type alias declarations as a child.
Parameter structures
Structures of the type alias declarations to add.
method addVariableStatement
addVariableStatement: ( structure: OptionalKind<VariableStatementStructure>) => VariableStatement;
Adds a variable statement.
Parameter structure
Structure of the variable statement.
method addVariableStatements
addVariableStatements: ( structures: ReadonlyArray<OptionalKind<VariableStatementStructure>>) => VariableStatement[];
Adds variable statements.
Parameter structures
Structures of the variable statements.
method getClass
getClass: { (name: string): ClassDeclaration | undefined; (findFunction: (declaration: ClassDeclaration) => boolean): ClassDeclaration;};
Gets a class.
Parameter name
Name of the class.
Gets a class.
Parameter findFunction
Function to use to find the class.
method getClasses
getClasses: () => ClassDeclaration[];
Gets the direct class declaration children.
method getClassOrThrow
getClassOrThrow: { (name: string): ClassDeclaration; (findFunction: (declaration: ClassDeclaration) => boolean): ClassDeclaration;};
Gets a class or throws if it doesn't exist.
Parameter name
Name of the class.
Gets a class or throws if it doesn't exist.
Parameter findFunction
Function to use to find the class.
method getEnum
getEnum: { (name: string): EnumDeclaration | undefined; (findFunction: (declaration: EnumDeclaration) => boolean): EnumDeclaration;};
Gets an enum.
Parameter name
Name of the enum.
Gets an enum.
Parameter findFunction
Function to use to find the enum.
method getEnumOrThrow
getEnumOrThrow: { (name: string): EnumDeclaration; (findFunction: (declaration: EnumDeclaration) => boolean): EnumDeclaration;};
Gets an enum or throws if it doesn't exist.
Parameter name
Name of the enum.
Gets an enum or throws if it doesn't exist.
Parameter findFunction
Function to use to find the enum.
method getEnums
getEnums: () => EnumDeclaration[];
Gets the direct enum declaration children.
method getFunction
getFunction: { (name: string): FunctionDeclaration | undefined; ( findFunction: (declaration: FunctionDeclaration) => boolean ): FunctionDeclaration;};
Gets a function.
Parameter name
Name of the function.
Gets a function.
Parameter findFunction
Function to use to find the function.
method getFunctionOrThrow
getFunctionOrThrow: { (name: string): FunctionDeclaration; ( findFunction: (declaration: FunctionDeclaration) => boolean ): FunctionDeclaration;};
Gets a function or throws if it doesn't exist.
Parameter name
Name of the function.
Gets a function or throws if it doesn't exist.
Parameter findFunction
Function to use to find the function.
method getFunctions
getFunctions: () => FunctionDeclaration[];
Gets the direct function declaration children.
method getInterface
getInterface: { (name: string): InterfaceDeclaration | undefined; ( findFunction: (declaration: InterfaceDeclaration) => boolean ): InterfaceDeclaration;};
Gets an interface.
Parameter name
Name of the interface.
Gets an interface.
Parameter findFunction
Function to use to find the interface.
method getInterfaceOrThrow
getInterfaceOrThrow: { (name: string): InterfaceDeclaration; ( findFunction: (declaration: InterfaceDeclaration) => boolean ): InterfaceDeclaration;};
Gets an interface or throws if it doesn't exist.
Parameter name
Name of the interface.
Gets an interface or throws if it doesn't exist.
Parameter findFunction
Function to use to find the interface.
method getInterfaces
getInterfaces: () => InterfaceDeclaration[];
Gets the direct interface declaration children.
method getModule
getModule: { (name: string): ModuleDeclaration | undefined; ( findFunction: (declaration: ModuleDeclaration) => boolean ): ModuleDeclaration;};
Gets a module declaration child by name.
Parameter name
Name of the namespace.
Gets a module declaration child by condition.
Parameter findFunction
Function to use to find the namespace.
method getModuleOrThrow
getModuleOrThrow: { (name: string): ModuleDeclaration; ( findFunction: (declaration: ModuleDeclaration) => boolean ): ModuleDeclaration;};
Gets a module declaration child by name or throws if it doesn't exist.
Parameter name
Name of the namespace.
Gets a module declaration child by condition or throws if it doesn't exist.
Parameter findFunction
Function to use to find the namespace.
method getModules
getModules: () => ModuleDeclaration[];
Gets the module declaration children.
method getStatement
getStatement: { <T extends Statement<ts.Statement>>( findFunction: (statement: Statement) => statement is T ): T | undefined; ( findFunction: (statement: Statement<ts.Statement>) => boolean ): Statement<ts.Statement>;};
Gets the first statement that matches the provided condition or returns undefined if it doesn't exist.
Parameter findFunction
Function to find the statement by.
method getStatementByKind
getStatementByKind: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappingsWithCommentStatements[TKind] | undefined;
Gets the first statement that matches the provided syntax kind or returns undefined if it doesn't exist.
Parameter kind
Syntax kind to find the node by.
method getStatementByKindOrThrow
getStatementByKindOrThrow: <TKind extends SyntaxKind>( kind: TKind) => KindToNodeMappingsWithCommentStatements[TKind];
Gets the first statement that matches the provided syntax kind or throws if it doesn't exist.
Parameter kind
Syntax kind to find the node by.
method getStatementOrThrow
getStatementOrThrow: { <T extends Statement<ts.Statement>>( findFunction: (statement: Statement) => statement is T ): T; ( findFunction: (statement: Statement<ts.Statement>) => boolean ): Statement<ts.Statement>;};
Gets the first statement that matches the provided condition or throws if it doesn't exist.
Parameter findFunction
Function to find the statement by.
method getStatements
getStatements: () => Statement[];
Gets the node's statements.
method getStatementsWithComments
getStatementsWithComments: () => Statement[];
Gets the node's statements with comment statements.
method getTypeAlias
getTypeAlias: { (name: string): TypeAliasDeclaration | undefined; ( findFunction: (declaration: TypeAliasDeclaration) => boolean ): TypeAliasDeclaration;};
Gets a type alias.
Parameter name
Name of the type alias.
Gets a type alias.
Parameter findFunction
Function to use to find the type alias.
method getTypeAliases
getTypeAliases: () => TypeAliasDeclaration[];
Gets the direct type alias declaration children.
method getTypeAliasOrThrow
getTypeAliasOrThrow: { (name: string): TypeAliasDeclaration; ( findFunction: (declaration: TypeAliasDeclaration) => boolean ): TypeAliasDeclaration;};
Gets a type alias or throws if it doesn't exist.
Parameter name
Name of the type alias.
Gets a type alias or throws if it doesn't exist.
Parameter findFunction
Function to use to find the type alias.
method getVariableDeclaration
getVariableDeclaration: { (name: string): VariableDeclaration | undefined; ( findFunction: (declaration: VariableDeclaration) => boolean ): VariableDeclaration;};
Gets a variable declaration.
Parameter name
Name of the variable declaration.
Gets a variable declaration.
Parameter findFunction
Function to use to find the variable declaration.
method getVariableDeclarationOrThrow
getVariableDeclarationOrThrow: { (name: string): VariableDeclaration; ( findFunction: (declaration: VariableDeclaration) => boolean ): VariableDeclaration;};
Gets a variable declaration or throws if it doesn't exist.
Parameter name
Name of the variable declaration.
Gets a variable declaration or throws if it doesn't exist.
Parameter findFunction
Function to use to find the variable declaration.
method getVariableDeclarations
getVariableDeclarations: () => VariableDeclaration[];
Gets all the variable declarations within the variable statement children.
Remarks
This does not return the variable declarations within for statements or for of statements.
method getVariableStatement
getVariableStatement: { (name: string): VariableStatement | undefined; ( findFunction: (declaration: VariableStatement) => boolean ): VariableStatement;};
Gets a variable statement.
Parameter name
Name of one of the variable statement's declarations.
Gets a variable statement.
Parameter findFunction
Function to use to find the variable statement.
method getVariableStatementOrThrow
getVariableStatementOrThrow: { (name: string): VariableStatement; ( findFunction: (declaration: VariableStatement) => boolean ): VariableStatement;};
Gets a variable statement or throws if it doesn't exist.
Parameter name
Name of one of the variable statement's declarations.
Gets a variable statement or throws if it doesn't exist.
Parameter findFunction
Function to use to find the variable statement.
method getVariableStatements
getVariableStatements: () => VariableStatement[];
Gets the direct variable statement children.
method insertClass
insertClass: ( index: number, structure: OptionalKind<ClassDeclarationStructure>) => ClassDeclaration;
Inserts an class declaration as a child.
Parameter index
Child index to insert at.
Parameter structure
Structure of the class declaration to insert.
method insertClasses
insertClasses: ( index: number, structures: ReadonlyArray<OptionalKind<ClassDeclarationStructure>>) => ClassDeclaration[];
Inserts class declarations as a child.
Parameter index
Child index to insert at.
Parameter structures
Structures of the class declarations to insert.
method insertEnum
insertEnum: ( index: number, structure: OptionalKind<EnumDeclarationStructure>) => EnumDeclaration;
Inserts an enum declaration as a child.
Parameter index
Child index to insert at.
Parameter structure
Structure of the enum declaration to insert.
method insertEnums
insertEnums: ( index: number, structures: ReadonlyArray<OptionalKind<EnumDeclarationStructure>>) => EnumDeclaration[];
Inserts enum declarations as a child.
Parameter index
Child index to insert at.
Parameter structures
Structures of the enum declarations to insert.
method insertFunction
insertFunction: ( index: number, structure: OptionalKind<FunctionDeclarationStructure>) => FunctionDeclaration;
Inserts an function declaration as a child.
Parameter index
Child index to insert at.
Parameter structure
Structure of the function declaration to insert.
method insertFunctions
insertFunctions: ( index: number, structures: ReadonlyArray<OptionalKind<FunctionDeclarationStructure>>) => FunctionDeclaration[];
Inserts function declarations as a child.
Parameter index
Child index to insert at.
Parameter structures
Structures of the function declarations to insert.
method insertInterface
insertInterface: ( index: number, structure: OptionalKind<InterfaceDeclarationStructure>) => InterfaceDeclaration;
Inserts an interface declaration as a child.
Parameter index
Child index to insert at.
Parameter structure
Structure of the interface declaration to insert.
method insertInterfaces
insertInterfaces: ( index: number, structures: ReadonlyArray<OptionalKind<InterfaceDeclarationStructure>>) => InterfaceDeclaration[];
Inserts interface declarations as a child.
Parameter index
Child index to insert at.
Parameter structures
Structures of the interface declarations to insert.
method insertModule
insertModule: ( index: number, structure: OptionalKind<ModuleDeclarationStructure>) => ModuleDeclaration;
Inserts a module declaration as a child.
Parameter index
Child index to insert at.
Parameter structure
Structure of the namespace declaration to insert.
method insertModules
insertModules: ( index: number, structures: ReadonlyArray<OptionalKind<ModuleDeclarationStructure>>) => ModuleDeclaration[];
Inserts module declarations as children.
Parameter index
Child index to insert at.
Parameter structures
Structures of the namespace declarations to insert.
method insertStatements
insertStatements: ( index: number, statements: | string | WriterFunction | ReadonlyArray<string | WriterFunction | StatementStructures>) => Statement[];
Inserts statements at the specified index.
Parameter index
Child index to insert at.
Parameter statements
Statements to insert.
Returns
The statements that were inserted.
method insertTypeAlias
insertTypeAlias: ( index: number, structure: OptionalKind<TypeAliasDeclarationStructure>) => TypeAliasDeclaration;
Inserts an type alias declaration as a child.
Parameter index
Child index to insert at.
Parameter structure
Structure of the type alias declaration to insert.
method insertTypeAliases
insertTypeAliases: ( index: number, structures: ReadonlyArray<OptionalKind<TypeAliasDeclarationStructure>>) => TypeAliasDeclaration[];
Inserts type alias declarations as a child.
Parameter index
Child index to insert at.
Parameter structures
Structures of the type alias declarations to insert.
method insertVariableStatement
insertVariableStatement: ( index: number, structure: OptionalKind<VariableStatementStructure>) => VariableStatement;
Inserts a variable statement.
Parameter structure
Structure of the variable statement.
method insertVariableStatements
insertVariableStatements: ( index: number, structures: ReadonlyArray<OptionalKind<VariableStatementStructure>>) => VariableStatement[];
Inserts variable statements.
Parameter structures
Structures of the variable statements.
method removeStatement
removeStatement: (index: number) => this;
Removes the statement at the specified index.
Parameter index
Child index to remove the statement at.
method removeStatements
removeStatements: (indexRange: [number, number]) => this;
Removes the statements at the specified index range.
Parameter indexRange
The start and end inclusive index range to remove.
interface StatementedNodeStructure
interface StatementedNodeStructure {}
property statements
statements?: | (string | WriterFunction | StatementStructures)[] | string | WriterFunction;
interface StaticableNode
interface StaticableNode {}
method getStaticKeyword
getStaticKeyword: () => Node | undefined;
Gets the static keyword, or undefined if none exists.
method getStaticKeywordOrThrow
getStaticKeywordOrThrow: (message?: string | (() => string)) => Node;
Gets the static keyword, or throws if none exists.
method isStatic
isStatic: () => boolean;
Gets if it's static.
method setIsStatic
setIsStatic: (value: boolean) => this;
Sets if the node is static.
Parameter value
If it should be static or not.
interface StaticableNodeStructure
interface StaticableNodeStructure {}
property isStatic
isStatic?: boolean;
interface Structure
interface Structure {}
property leadingTrivia
leadingTrivia?: string | WriterFunction | (string | WriterFunction)[];
Leading comments or whitespace.
property trailingTrivia
trailingTrivia?: string | WriterFunction | (string | WriterFunction)[];
Trailing comments or whitespace.
interface SuperExpressionedNode
interface SuperExpressionedNode extends BaseExpressionedNode<SuperExpression> {}
interface SupportedFormatCodeSettings
interface SupportedFormatCodeSettings extends SupportedFormatCodeSettingsOnly, EditorSettings {}
FormatCodeSettings that are currently supported in the library.
interface SupportedFormatCodeSettingsOnly
interface SupportedFormatCodeSettingsOnly {}
FormatCodeSettings that are currently supported in the library.
property insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces: boolean;
Whether to insert a space after opening and before closing non-empty braces.
ex.
import { Item } from "./Item";
orimport {Item} from "./Item";
Remarks
Defaults to true.
interface TextInsertableNode
interface TextInsertableNode {}
method insertText
insertText: (pos: number, textOrWriterFunction: string | WriterFunction) => this;
Inserts text within the body of the node.
WARNING: This will forget any previously navigated descendant nodes.
Parameter pos
Position to insert at.
Parameter textOrWriterFunction
Text to insert.
method removeText
removeText: { (): this; (pos: number, end: number): this };
Removes all the text within the node
Removes text within the body of the node.
WARNING: This will forget any previously navigated descendant nodes.
Parameter pos
Start position to remove.
Parameter end
End position to remove.
method replaceText
replaceText: ( range: [number, number], textOrWriterFunction: string | WriterFunction) => this;
Replaces text within the body of the node.
WARNING: This will forget any previously navigated descendant nodes.
Parameter range
Start and end position of the text to replace.
Parameter textOrWriterFunction
Text to replace the range with.
interface TransformTraversalControl
interface TransformTraversalControl {}
property currentNode
currentNode: ts.Node;
The node currently being transformed.
Remarks
Use the result of
.visitChildren()
instead before transforming if visiting the children.
property factory
factory: ts.NodeFactory;
Factory to create nodes with.
method visitChildren
visitChildren: () => ts.Node;
Visits the children of the current node and returns a new node for the current node.
interface TypeAliasDeclarationStructure
interface TypeAliasDeclarationStructure extends Structure, TypeAliasDeclarationSpecificStructure, NamedNodeStructure, TypedNodeStructure, TypeParameteredNodeStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure {}
property type
type: string | WriterFunction;
interface TypeArgumentedNode
interface TypeArgumentedNode {}
method addTypeArgument
addTypeArgument: (argumentText: string) => TypeNode;
Adds a type argument.
Parameter argumentText
Argument text to add.
method addTypeArguments
addTypeArguments: (argumentTexts: ReadonlyArray<string>) => TypeNode[];
Adds type arguments.
Parameter argumentTexts
Argument texts to add.
method getTypeArguments
getTypeArguments: () => TypeNode[];
Gets all the type arguments of the node.
method insertTypeArgument
insertTypeArgument: (index: number, argumentText: string) => TypeNode;
Inserts a type argument.
Parameter index
Child index to insert at.
Parameter argumentText
Argument text to insert.
method insertTypeArguments
insertTypeArguments: ( index: number, argumentTexts: ReadonlyArray<string>) => TypeNode[];
Inserts type arguments.
Parameter index
Child index to insert at.
Parameter argumentTexts
Argument texts to insert.
method removeTypeArgument
removeTypeArgument: { (typeArg: Node): this; (index: number): this };
Removes a type argument.
Parameter typeArg
Type argument to remove.
Removes a type argument.
Parameter index
Index to remove.
interface TypedNode
interface TypedNode {}
method getTypeNode
getTypeNode: () => TypeNode | undefined;
Gets the type node or undefined if none exists.
method getTypeNodeOrThrow
getTypeNodeOrThrow: (message?: string | (() => string)) => TypeNode;
Gets the type node or throws if none exists.
method removeType
removeType: () => this;
Removes the type.
method setType
setType: (textOrWriterFunction: string | WriterFunction) => this;
Sets the type.
Parameter textOrWriterFunction
Text or writer function to set the type with.
interface TypedNodeStructure
interface TypedNodeStructure {}
property type
type?: string | WriterFunction;
interface TypeElementMemberedNode
interface TypeElementMemberedNode {}
method addCallSignature
addCallSignature: ( structure: OptionalKind<CallSignatureDeclarationStructure>) => CallSignatureDeclaration;
Add call signature.
Parameter structure
Structure representing the call signature.
method addCallSignatures
addCallSignatures: ( structures: ReadonlyArray<OptionalKind<CallSignatureDeclarationStructure>>) => CallSignatureDeclaration[];
Add call signatures.
Parameter structures
Structures representing the call signatures.
method addConstructSignature
addConstructSignature: ( structure: OptionalKind<ConstructSignatureDeclarationStructure>) => ConstructSignatureDeclaration;
Add construct signature.
Parameter structure
Structure representing the construct signature.
method addConstructSignatures
addConstructSignatures: ( structures: ReadonlyArray< OptionalKind<ConstructSignatureDeclarationStructure> >) => ConstructSignatureDeclaration[];
Add construct signatures.
Parameter structures
Structures representing the construct signatures.
method addGetAccessor
addGetAccessor: ( structure: OptionalKind<GetAccessorDeclarationStructure>) => GetAccessorDeclaration;
Add get accessor.
Parameter structure
Structure representing the get accessor.
method addGetAccessors
addGetAccessors: ( structures: ReadonlyArray<OptionalKind<GetAccessorDeclarationStructure>>) => GetAccessorDeclaration[];
Add get accessors.
Parameter structures
Structures representing the get accessors.
method addIndexSignature
addIndexSignature: ( structure: OptionalKind<IndexSignatureDeclarationStructure>) => IndexSignatureDeclaration;
Add index signature.
Parameter structure
Structure representing the index signature.
method addIndexSignatures
addIndexSignatures: ( structures: ReadonlyArray<OptionalKind<IndexSignatureDeclarationStructure>>) => IndexSignatureDeclaration[];
Add index signatures.
Parameter structures
Structures representing the index signatures.
method addMember
addMember: ( member: string | WriterFunction | TypeElementMemberStructures) => TypeElementTypes | CommentTypeElement;
Adds a member.
Parameter member
Member to add.
method addMembers
addMembers: ( members: | string | WriterFunction | ReadonlyArray<string | WriterFunction | TypeElementMemberStructures>) => (TypeElementTypes | CommentTypeElement)[];
Adds members.
Parameter members
Collection of members to add.
method addMethod
addMethod: ( structure: OptionalKind<MethodSignatureStructure>) => MethodSignature;
Add method.
Parameter structure
Structure representing the method.
method addMethods
addMethods: ( structures: ReadonlyArray<OptionalKind<MethodSignatureStructure>>) => MethodSignature[];
Add methods.
Parameter structures
Structures representing the methods.
method addProperties
addProperties: ( structures: ReadonlyArray<OptionalKind<PropertySignatureStructure>>) => PropertySignature[];
Add properties.
Parameter structures
Structures representing the properties.
method addProperty
addProperty: ( structure: OptionalKind<PropertySignatureStructure>) => PropertySignature;
Add property.
Parameter structure
Structure representing the property.
method addSetAccessor
addSetAccessor: ( structure: OptionalKind<SetAccessorDeclarationStructure>) => SetAccessorDeclaration;
Add set accessor.
Parameter structure
Structure representing the set accessor.
method addSetAccessors
addSetAccessors: ( structures: ReadonlyArray<OptionalKind<SetAccessorDeclarationStructure>>) => SetAccessorDeclaration[];
Add set accessors.
Parameter structures
Structures representing the set accessors.
method getCallSignature
getCallSignature: ( findFunction: (member: CallSignatureDeclaration) => boolean) => CallSignatureDeclaration | undefined;
Gets the first call signature by a find function.
Parameter findFunction
Function to find the call signature by.
method getCallSignatureOrThrow
getCallSignatureOrThrow: ( findFunction: (member: CallSignatureDeclaration) => boolean) => CallSignatureDeclaration;
Gets the first call signature by a find function or throws if not found.
Parameter findFunction
Function to find the call signature by.
method getCallSignatures
getCallSignatures: () => CallSignatureDeclaration[];
Gets the interface call signatures.
method getConstructSignature
getConstructSignature: ( findFunction: (member: ConstructSignatureDeclaration) => boolean) => ConstructSignatureDeclaration | undefined;
Gets the first construct signature by a find function.
Parameter findFunction
Function to find the construct signature by.
method getConstructSignatureOrThrow
getConstructSignatureOrThrow: ( findFunction: (member: ConstructSignatureDeclaration) => boolean) => ConstructSignatureDeclaration;
Gets the first construct signature by a find function or throws if not found.
Parameter findFunction
Function to find the construct signature by.
method getConstructSignatures
getConstructSignatures: () => ConstructSignatureDeclaration[];
Gets the interface construct signatures.
method getGetAccessor
getGetAccessor: { (name: string): GetAccessorDeclaration | undefined; ( findFunction: (member: GetAccessorDeclaration) => boolean ): GetAccessorDeclaration;};
Gets the first get accessor by name.
Parameter name
Name.
Gets the first get accessor by a find function.
Parameter findFunction
Function to find the get accessor by.
method getGetAccessorOrThrow
getGetAccessorOrThrow: { (name: string): GetAccessorDeclaration; ( findFunction: (member: GetAccessorDeclaration) => boolean ): GetAccessorDeclaration;};
Gets the first get accessor by name or throws if not found.
Parameter name
Name.
Gets the first get accessor by a find function or throws if not found.
Parameter findFunction
Function to find the get accessor by.
method getGetAccessors
getGetAccessors: () => GetAccessorDeclaration[];
Gets the interface get accessor declarations.
method getIndexSignature
getIndexSignature: ( findFunction: (member: IndexSignatureDeclaration) => boolean) => IndexSignatureDeclaration | undefined;
Gets the first index signature by a find function.
Parameter findFunction
Function to find the index signature by.
method getIndexSignatureOrThrow
getIndexSignatureOrThrow: ( findFunction: (member: IndexSignatureDeclaration) => boolean) => IndexSignatureDeclaration;
Gets the first index signature by a find function or throws if not found.
Parameter findFunction
Function to find the index signature by.
method getIndexSignatures
getIndexSignatures: () => IndexSignatureDeclaration[];
Gets the interface index signatures.
method getMembers
getMembers: () => TypeElementTypes[];
Gets all the members.
method getMembersWithComments
getMembersWithComments: () => (TypeElementTypes | CommentTypeElement)[];
Gets all the members with comment type elements.
method getMethod
getMethod: { (name: string): MethodSignature | undefined; (findFunction: (member: MethodSignature) => boolean): MethodSignature;};
Gets the first method by name.
Parameter name
Name.
Gets the first method by a find function.
Parameter findFunction
Function to find the method by.
method getMethodOrThrow
getMethodOrThrow: { (name: string): MethodSignature; (findFunction: (member: MethodSignature) => boolean): MethodSignature;};
Gets the first method by name or throws if not found.
Parameter name
Name.
Gets the first method by a find function or throws if not found.
Parameter findFunction
Function to find the method by.
method getMethods
getMethods: () => MethodSignature[];
Gets the interface method signatures.
method getProperties
getProperties: () => PropertySignature[];
Gets the interface property signatures.
method getProperty
getProperty: { (name: string): PropertySignature | undefined; (findFunction: (member: PropertySignature) => boolean): PropertySignature;};
Gets the first property by name.
Parameter name
Name.
Gets the first property by a find function.
Parameter findFunction
Function to find the property by.
method getPropertyOrThrow
getPropertyOrThrow: { (name: string): PropertySignature; (findFunction: (member: PropertySignature) => boolean): PropertySignature;};
Gets the first property by name or throws if not found.
Parameter name
Name.
Gets the first property by a find function or throws if not found.
Parameter findFunction
Function to find the property by.
method getSetAccessor
getSetAccessor: { (name: string): SetAccessorDeclaration | undefined; ( findFunction: (member: SetAccessorDeclaration) => boolean ): SetAccessorDeclaration;};
Gets the first set accessor by name.
Parameter name
Name.
Gets the first set accessor by a find function.
Parameter findFunction
Function to find the set accessor by.
method getSetAccessorOrThrow
getSetAccessorOrThrow: { (name: string): SetAccessorDeclaration; ( findFunction: (member: SetAccessorDeclaration) => boolean ): SetAccessorDeclaration;};
Gets the first set accessor by name or throws if not found.
Parameter name
Name.
Gets the first set accessor by a find function or throws if not found.
Parameter findFunction
Function to find the set accessor by.
method getSetAccessors
getSetAccessors: () => SetAccessorDeclaration[];
Gets the interface set accessor declarations.
method insertCallSignature
insertCallSignature: ( index: number, structure: OptionalKind<CallSignatureDeclarationStructure>) => CallSignatureDeclaration;
Insert call signature.
Parameter index
Child index to insert at.
Parameter structure
Structure representing the call signature.
method insertCallSignatures
insertCallSignatures: ( index: number, structures: ReadonlyArray<OptionalKind<CallSignatureDeclarationStructure>>) => CallSignatureDeclaration[];
Insert call signatures.
Parameter index
Child index to insert at.
Parameter structures
Structures representing the call signatures.
method insertConstructSignature
insertConstructSignature: ( index: number, structure: OptionalKind<ConstructSignatureDeclarationStructure>) => ConstructSignatureDeclaration;
Insert construct signature.
Parameter index
Child index to insert at.
Parameter structure
Structure representing the construct signature.
method insertConstructSignatures
insertConstructSignatures: ( index: number, structures: ReadonlyArray< OptionalKind<ConstructSignatureDeclarationStructure> >) => ConstructSignatureDeclaration[];
Insert construct signatures.
Parameter index
Child index to insert at.
Parameter structures
Structures representing the construct signatures.
method insertGetAccessor
insertGetAccessor: ( index: number, structure: OptionalKind<GetAccessorDeclarationStructure>) => GetAccessorDeclaration;
Insert get accessor.
Parameter index
Child index to insert at.
Parameter structure
Structure representing the get accessor.
method insertGetAccessors
insertGetAccessors: ( index: number, structures: ReadonlyArray<OptionalKind<GetAccessorDeclarationStructure>>) => GetAccessorDeclaration[];
Insert get accessors.
Parameter index
Child index to insert at.
Parameter structures
Structures representing the get accessors.
method insertIndexSignature
insertIndexSignature: ( index: number, structure: OptionalKind<IndexSignatureDeclarationStructure>) => IndexSignatureDeclaration;
Insert index signature.
Parameter index
Child index to insert at.
Parameter structure
Structure representing the index signature.
method insertIndexSignatures
insertIndexSignatures: ( index: number, structures: ReadonlyArray<OptionalKind<IndexSignatureDeclarationStructure>>) => IndexSignatureDeclaration[];
Insert index signatures.
Parameter index
Child index to insert at.
Parameter structures
Structures representing the index signatures.
method insertMember
insertMember: ( index: number, member: string | WriterFunction | TypeElementMemberStructures) => TypeElementTypes | CommentTypeElement;
Inserts a member.
Parameter index
Child index to insert at.
Parameter member
Member to insert.
method insertMembers
insertMembers: ( index: number, members: | string | WriterFunction | ReadonlyArray<string | WriterFunction | TypeElementMemberStructures>) => (TypeElementTypes | CommentTypeElement)[];
Inserts members.
Parameter index
Child index to insert at.
Parameter members
Collection of members to insert.
method insertMethod
insertMethod: ( index: number, structure: OptionalKind<MethodSignatureStructure>) => MethodSignature;
Insert method.
Parameter index
Child index to insert at.
Parameter structure
Structure representing the method.
method insertMethods
insertMethods: ( index: number, structures: ReadonlyArray<OptionalKind<MethodSignatureStructure>>) => MethodSignature[];
Insert methods.
Parameter index
Child index to insert at.
Parameter structures
Structures representing the methods.
method insertProperties
insertProperties: ( index: number, structures: ReadonlyArray<OptionalKind<PropertySignatureStructure>>) => PropertySignature[];
Insert properties.
Parameter index
Child index to insert at.
Parameter structures
Structures representing the properties.
method insertProperty
insertProperty: ( index: number, structure: OptionalKind<PropertySignatureStructure>) => PropertySignature;
Insert property.
Parameter index
Child index to insert at.
Parameter structure
Structure representing the property.
method insertSetAccessor
insertSetAccessor: ( index: number, structure: OptionalKind<SetAccessorDeclarationStructure>) => SetAccessorDeclaration;
Insert set accessor.
Parameter index
Child index to insert at.
Parameter structure
Structure representing the set accessor.
method insertSetAccessors
insertSetAccessors: ( index: number, structures: ReadonlyArray<OptionalKind<SetAccessorDeclarationStructure>>) => SetAccessorDeclaration[];
Insert set accessors.
Parameter index
Child index to insert at.
Parameter structures
Structures representing the set accessors.
interface TypeElementMemberedNodeStructure
interface TypeElementMemberedNodeStructure {}
property callSignatures
callSignatures?: OptionalKind<CallSignatureDeclarationStructure>[];
property constructSignatures
constructSignatures?: OptionalKind<ConstructSignatureDeclarationStructure>[];
property getAccessors
getAccessors?: OptionalKind<GetAccessorDeclarationStructure>[];
property indexSignatures
indexSignatures?: OptionalKind<IndexSignatureDeclarationStructure>[];
property methods
methods?: OptionalKind<MethodSignatureStructure>[];
property properties
properties?: OptionalKind<PropertySignatureStructure>[];
property setAccessors
setAccessors?: OptionalKind<SetAccessorDeclarationStructure>[];
interface TypeParameterDeclarationStructure
interface TypeParameterDeclarationStructure extends Structure, TypeParameterDeclarationSpecificStructure, NamedNodeStructure {}
interface TypeParameteredNode
interface TypeParameteredNode {}
method addTypeParameter
addTypeParameter: ( structure: OptionalKind<TypeParameterDeclarationStructure> | string) => TypeParameterDeclaration;
Adds a type parameter.
Parameter structure
Structure of the type parameter.
method addTypeParameters
addTypeParameters: ( structures: ReadonlyArray< OptionalKind<TypeParameterDeclarationStructure> | string >) => TypeParameterDeclaration[];
Adds type parameters.
Parameter structures
Structures of the type parameters.
method getTypeParameter
getTypeParameter: { (name: string): TypeParameterDeclaration | undefined; ( findFunction: (declaration: TypeParameterDeclaration) => boolean ): TypeParameterDeclaration;};
Gets a type parameter or undefined if it doesn't exist.
Parameter name
Name of the parameter.
Gets a type parameter or undefined if it doesn't exist.
Parameter findFunction
Function to use to find the type parameter.
method getTypeParameterOrThrow
getTypeParameterOrThrow: { (name: string): TypeParameterDeclaration; ( findFunction: (declaration: TypeParameterDeclaration) => boolean ): TypeParameterDeclaration;};
Gets a type parameter or throws if it doesn't exist.
Parameter name
Name of the parameter.
Gets a type parameter or throws if it doesn't exist.
Parameter findFunction
Function to use to find the type parameter.
method getTypeParameters
getTypeParameters: () => TypeParameterDeclaration[];
Gets the type parameters.
method insertTypeParameter
insertTypeParameter: ( index: number, structure: OptionalKind<TypeParameterDeclarationStructure> | string) => TypeParameterDeclaration;
Inserts a type parameter.
Parameter index
Child index to insert at. Specify a negative index to insert from the reverse.
Parameter structure
Structure of the type parameter.
method insertTypeParameters
insertTypeParameters: ( index: number, structures: ReadonlyArray< OptionalKind<TypeParameterDeclarationStructure> | string >) => TypeParameterDeclaration[];
Inserts type parameters.
Parameter index
Child index to insert at. Specify a negative index to insert from the reverse.
Parameter structures
Structures of the type parameters.
interface TypeParameteredNodeStructure
interface TypeParameteredNodeStructure {}
property typeParameters
typeParameters?: (OptionalKind<TypeParameterDeclarationStructure> | string)[];
interface UnaryExpressionedNode
interface UnaryExpressionedNode extends BaseExpressionedNode<UnaryExpression> {}
interface UnwrappableNode
interface UnwrappableNode {}
method unwrap
unwrap: () => void;
Replaces the node's text with its body's statements.
interface UserPreferences
interface UserPreferences extends ts.UserPreferences {}
User preferences for refactoring.
interface VariableDeclarationStructure
interface VariableDeclarationStructure extends Structure, VariableDeclarationSpecificStructure, BindingNamedNodeStructure, InitializerExpressionableNodeStructure, TypedNodeStructure, ExclamationTokenableNodeStructure {}
interface VariableStatementStructure
interface VariableStatementStructure extends Structure, VariableStatementSpecificStructure, JSDocableNodeStructure, AmbientableNodeStructure, ExportableNodeStructure {}
Enums
enum FileSystemRefreshResult
enum FileSystemRefreshResult { NoChange = 0, Updated = 1, Deleted = 2,}
Result of refreshing a source file from the file system.
enum IndentationText
enum IndentationText { TwoSpaces = ' ', FourSpaces = ' ', EightSpaces = ' ', Tab = '\t',}
Kinds of indentation
member EightSpaces
EightSpaces = ' '
Eight spaces
member FourSpaces
FourSpaces = ' '
Four spaces
member Tab
Tab = '\t'
Tab
member TwoSpaces
TwoSpaces = ' '
Two spaces
enum ModuleDeclarationKind
enum ModuleDeclarationKind { Namespace = 'namespace', Module = 'module', Global = 'global',}
enum QuoteKind
enum QuoteKind { Single = "'", Double = '"',}
Quote type for a string literal.
enum Scope
enum Scope { Public = 'public', Protected = 'protected', Private = 'private',}
enum StructureKind
enum StructureKind { ImportAttribute = 0, CallSignature = 1, Class = 2, ClassStaticBlock = 3, ConstructSignature = 4, Constructor = 5, ConstructorOverload = 6, Decorator = 7, Enum = 8, EnumMember = 9, ExportAssignment = 10, ExportDeclaration = 11, ExportSpecifier = 12, Function = 13, FunctionOverload = 14, GetAccessor = 15, ImportDeclaration = 16, ImportSpecifier = 17, IndexSignature = 18, Interface = 19, JsxAttribute = 20, JsxSpreadAttribute = 21, JsxElement = 22, JsxSelfClosingElement = 23, JSDoc = 24, JSDocTag = 25, Method = 26, MethodOverload = 27, MethodSignature = 28, Module = 29, Parameter = 30, Property = 31, PropertyAssignment = 32, PropertySignature = 33, SetAccessor = 34, ShorthandPropertyAssignment = 35, SourceFile = 36, SpreadAssignment = 37, TypeAlias = 38, TypeParameter = 39, VariableDeclaration = 40, VariableStatement = 41,}
member CallSignature
CallSignature = 1
member Class
Class = 2
member ClassStaticBlock
ClassStaticBlock = 3
member Constructor
Constructor = 5
member ConstructorOverload
ConstructorOverload = 6
member ConstructSignature
ConstructSignature = 4
member Decorator
Decorator = 7
member Enum
Enum = 8
member EnumMember
EnumMember = 9
member ExportAssignment
ExportAssignment = 10
member ExportDeclaration
ExportDeclaration = 11
member ExportSpecifier
ExportSpecifier = 12
member Function
Function = 13
member FunctionOverload
FunctionOverload = 14
member GetAccessor
GetAccessor = 15
member ImportAttribute
ImportAttribute = 0
member ImportDeclaration
ImportDeclaration = 16
member ImportSpecifier
ImportSpecifier = 17
member IndexSignature
IndexSignature = 18
member Interface
Interface = 19
member JSDoc
JSDoc = 24
member JSDocTag
JSDocTag = 25
member JsxAttribute
JsxAttribute = 20
member JsxElement
JsxElement = 22
member JsxSelfClosingElement
JsxSelfClosingElement = 23
member JsxSpreadAttribute
JsxSpreadAttribute = 21
member Method
Method = 26
member MethodOverload
MethodOverload = 27
member MethodSignature
MethodSignature = 28
member Module
Module = 29
member Parameter
Parameter = 30
member Property
Property = 31
member PropertyAssignment
PropertyAssignment = 32
member PropertySignature
PropertySignature = 33
member SetAccessor
SetAccessor = 34
member ShorthandPropertyAssignment
ShorthandPropertyAssignment = 35
member SourceFile
SourceFile = 36
member SpreadAssignment
SpreadAssignment = 37
member TypeAlias
TypeAlias = 38
member TypeParameter
TypeParameter = 39
member VariableDeclaration
VariableDeclaration = 40
member VariableStatement
VariableStatement = 41
enum TypeParameterVariance
enum TypeParameterVariance { None = 0, In = 1, Out = 2, InOut = 3,}
Variance of the type parameter.
enum VariableDeclarationKind
enum VariableDeclarationKind { Var = 'var', Let = 'let', Const = 'const', AwaitUsing = 'await using', Using = 'using',}
member AwaitUsing
AwaitUsing = 'await using'
member Const
Const = 'const'
member Let
Let = 'let'
member Using
Using = 'using'
member Var
Var = 'var'
Type Aliases
type AccessorDeclaration
type AccessorDeclaration = GetAccessorDeclaration | SetAccessorDeclaration;
type ArrayBindingElement
type ArrayBindingElement = BindingElement | OmittedExpression;
type AssertionKey
type AssertionKey = Identifier | StringLiteral;
type BindingName
type BindingName = Identifier | BindingPattern;
type BindingNamedNodeSpecific
type BindingNamedNodeSpecific = NamedNodeSpecificBase<BindingName>;
type BindingPattern
type BindingPattern = ObjectBindingPattern | ArrayBindingPattern;
type BooleanLiteral
type BooleanLiteral = TrueLiteral | FalseLiteral;
type CallLikeExpression
type CallLikeExpression = | CallExpression | NewExpression | TaggedTemplateExpression | Decorator | JsxCallLike | InstanceofExpression;
type CaseOrDefaultClause
type CaseOrDefaultClause = CaseClause | DefaultClause;
type ClassInstanceMemberTypes
type ClassInstanceMemberTypes = MethodDeclaration | ClassInstancePropertyTypes;
type ClassInstancePropertyTypes
type ClassInstancePropertyTypes = ClassPropertyTypes | ParameterDeclaration;
type ClassMemberStructures
type ClassMemberStructures = | ConstructorDeclarationStructure | GetAccessorDeclarationStructure | SetAccessorDeclarationStructure | MethodDeclarationStructure | PropertyDeclarationStructure | ClassStaticBlockDeclarationStructure;
type ClassMemberTypes
type ClassMemberTypes = | MethodDeclaration | PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration | ConstructorDeclaration | ClassStaticBlockDeclaration;
type ClassPropertyTypes
type ClassPropertyTypes = | PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration;
type ClassStaticMemberTypes
type ClassStaticMemberTypes = | MethodDeclaration | ClassStaticBlockDeclaration | ClassStaticPropertyTypes;
type ClassStaticPropertyTypes
type ClassStaticPropertyTypes = | PropertyDeclaration | GetAccessorDeclaration | SetAccessorDeclaration;
type CompilerNodeToWrappedType
type CompilerNodeToWrappedType<T extends ts.Node> = T extends ts.ObjectDestructuringAssignment ? ObjectDestructuringAssignment : T extends ts.ArrayDestructuringAssignment ? ArrayDestructuringAssignment : T extends ts.SuperElementAccessExpression ? SuperElementAccessExpression : T extends ts.SuperPropertyAccessExpression ? SuperPropertyAccessExpression : T extends ts.AssignmentExpression<infer U> ? AssignmentExpression<ts.AssignmentExpression<U>> : T['kind'] extends keyof ImplementedKindToNodeMappings ? ImplementedKindToNodeMappings[T['kind']] : T extends ts.SyntaxList ? SyntaxList : T extends ts.JSDocTypeExpression ? JSDocTypeExpression : T extends ts.JSDocType ? JSDocType : T extends ts.NodeWithTypeArguments ? NodeWithTypeArguments : T extends ts.TypeNode ? TypeNode : T extends ts.JSDocTag ? JSDocTag : T extends ts.LiteralExpression ? LiteralExpression : T extends ts.PrimaryExpression ? PrimaryExpression : T extends ts.MemberExpression ? MemberExpression : T extends ts.LeftHandSideExpression ? LeftHandSideExpression : T extends ts.UpdateExpression ? UpdateExpression : T extends ts.UnaryExpression ? UnaryExpression : T extends ts.Expression ? Expression : T extends ts.IterationStatement ? IterationStatement : T extends CompilerCommentStatement ? CommentStatement : T extends CompilerCommentClassElement ? CommentClassElement : T extends CompilerCommentTypeElement ? CommentTypeElement : T extends CompilerCommentObjectLiteralElement ? CommentObjectLiteralElement : T extends CompilerCommentEnumMember ? CommentEnumMember : T extends ts.TypeElement ? TypeElement : T extends ts.Statement ? Statement : T extends ts.ClassElement ? ClassElement : T extends ts.ObjectLiteralElement ? ObjectLiteralElement : Node<T>;
type Constructor
type Constructor<T> = new (...args: any[]) => T;
type DeclarationName
type DeclarationName = | PropertyName | JsxAttributeName | StringLiteralLike | ElementAccessExpression | BindingPattern | EntityNameExpression;
type EntityName
type EntityName = Identifier | QualifiedName;
type EntityNameExpression
type EntityNameExpression = Identifier | PropertyAccessExpression;
type ExportedDeclarations
type ExportedDeclarations = | ClassDeclaration | InterfaceDeclaration | EnumDeclaration | FunctionDeclaration | VariableDeclaration | TypeAliasDeclaration | ModuleDeclaration | Expression | SourceFile;
Declarations that can be exported from a module.
Remarks
This may be missing some types. Please open an issue if this returns a type not listed here.
type ImportAttributeNamedNodeSpecific
type ImportAttributeNamedNodeSpecific = NamedNodeSpecificBase<AssertionKey>;
type InstanceOf
type InstanceOf<T> = T extends new (...args: any[]) => infer U ? U : never;
type InterfaceMemberStructures
type InterfaceMemberStructures = TypeElementMemberStructures;
type JsxAttributeLike
type JsxAttributeLike = JsxAttribute | JsxSpreadAttribute;
type JsxAttributeName
type JsxAttributeName = Identifier | JsxNamespacedName;
type JsxCallLike
type JsxCallLike = JsxOpeningLikeElement | JsxOpeningFragment;
type JsxChild
type JsxChild = | JsxText | JsxExpression | JsxElement | JsxSelfClosingElement | JsxFragment;
type JsxOpeningLikeElement
type JsxOpeningLikeElement = JsxSelfClosingElement | JsxOpeningElement;
type JsxStructures
type JsxStructures = | JsxAttributeStructure | JsxSpreadAttributeStructure | JsxElementStructure | JsxSelfClosingElementStructure;
type JsxTagNameExpression
type JsxTagNameExpression = | Identifier | ThisExpression | JsxTagNamePropertyAccess | JsxNamespacedName;
type LocalTargetDeclarations
type LocalTargetDeclarations = | SourceFile | ClassDeclaration | InterfaceDeclaration | EnumDeclaration | FunctionDeclaration | VariableDeclaration | TypeAliasDeclaration | ModuleDeclaration | ExportAssignment;
Local target declarations.
Remarks
This may be missing some types. Please open an issue if this returns a type not listed here.
type ModifierTexts
type ModifierTexts = | 'export' | 'default' | 'declare' | 'abstract' | 'public' | 'protected' | 'private' | 'readonly' | 'static' | 'async' | 'const' | 'override' | 'in' | 'out' | 'accessor';
type ModuleName
type ModuleName = Identifier | StringLiteral;
type ModuleNamedNodeSpecific
type ModuleNamedNodeSpecific = NamedNodeSpecificBase<ModuleName>;
type ModuleReference
type ModuleReference = EntityName | ExternalModuleReference;
type NamedNodeSpecific
type NamedNodeSpecific = NamedNodeSpecificBase<Identifier>;
type NodeParentType
type NodeParentType<NodeType extends ts.Node> = NodeType extends ts.SourceFile ? undefined : ts.Node extends NodeType ? CompilerNodeToWrappedType<NodeType['parent']> | undefined : CompilerNodeToWrappedType<NodeType['parent']>;
type NodePropertyToWrappedType
type NodePropertyToWrappedType< NodeType extends ts.Node, KeyName extends keyof NodeType, NonNullableNodeType = NonNullable<NodeType[KeyName]>> = NodeType[KeyName] extends | ts.NodeArray<infer ArrayNodeTypeForNullable> | undefined ? CompilerNodeToWrappedType<ArrayNodeTypeForNullable>[] | undefined : NodeType[KeyName] extends ts.NodeArray<infer ArrayNodeType> ? CompilerNodeToWrappedType<ArrayNodeType>[] : NodeType[KeyName] extends ts.Node ? CompilerNodeToWrappedType<NodeType[KeyName]> : NonNullableNodeType extends ts.Node ? CompilerNodeToWrappedType<NonNullableNodeType> | undefined : NodeType[KeyName];
type ObjectLiteralElementLike
type ObjectLiteralElementLike = | PropertyAssignment | ShorthandPropertyAssignment | SpreadAssignment | MethodDeclaration | AccessorDeclaration;
type ObjectLiteralExpressionPropertyStructures
type ObjectLiteralExpressionPropertyStructures = | PropertyAssignmentStructure | ShorthandPropertyAssignmentStructure | SpreadAssignmentStructure | GetAccessorDeclarationStructure | SetAccessorDeclarationStructure | MethodDeclarationStructure;
type OptionalKind
type OptionalKind< TStructure extends { kind?: StructureKind; }> = Pick<TStructure, Exclude<keyof TStructure, 'kind'>> & Partial<Pick<TStructure, 'kind'>>;
type PropertyName
type PropertyName = | Identifier | StringLiteral | NumericLiteral | ComputedPropertyName | PrivateIdentifier | NoSubstitutionTemplateLiteral | BigIntLiteral;
type PropertyNamedNodeSpecific
type PropertyNamedNodeSpecific = NamedNodeSpecificBase<PropertyName>;
type ResolutionHostFactory
type ResolutionHostFactory = ( moduleResolutionHost: ts.ModuleResolutionHost, getCompilerOptions: () => ts.CompilerOptions) => ResolutionHost;
Factory used to create a resolution host.
Remarks
The compiler options are retrieved via a function in order to get the project's current compiler options.
type SourceFileReferencingNodes
type SourceFileReferencingNodes = | ImportDeclaration | ExportDeclaration | ImportEqualsDeclaration | CallExpression;
type StatementStructures
type StatementStructures = | ClassDeclarationStructure | EnumDeclarationStructure | FunctionDeclarationStructure | InterfaceDeclarationStructure | ModuleDeclarationStructure | TypeAliasDeclarationStructure | ImportDeclarationStructure | ExportDeclarationStructure | ExportAssignmentStructure | VariableStatementStructure;
type StringLiteralLike
type StringLiteralLike = StringLiteral | NoSubstitutionTemplateLiteral;
type Structures
type Structures = | ImportAttributeStructure | StatementStructures | ClassMemberStructures | EnumMemberStructure | InterfaceMemberStructures | ObjectLiteralExpressionPropertyStructures | JsxStructures | FunctionDeclarationOverloadStructure | MethodDeclarationOverloadStructure | ConstructorDeclarationOverloadStructure | ParameterDeclarationStructure | TypeParameterDeclarationStructure | SourceFileStructure | ExportSpecifierStructure | ImportSpecifierStructure | VariableDeclarationStructure | JSDocStructure | JSDocTagStructure | DecoratorStructure;
type TemplateLiteral
type TemplateLiteral = TemplateExpression | NoSubstitutionTemplateLiteral;
type TypeElementMemberStructures
type TypeElementMemberStructures = | CallSignatureDeclarationStructure | ConstructSignatureDeclarationStructure | IndexSignatureDeclarationStructure | MethodSignatureStructure | PropertySignatureStructure;
type TypeElementTypes
type TypeElementTypes = | PropertySignature | MethodSignature | ConstructSignatureDeclaration | CallSignatureDeclaration | IndexSignatureDeclaration | GetAccessorDeclaration | SetAccessorDeclaration;
type WriterFunction
type WriterFunction = (writer: CodeBlockWriter) => void;
type WriterFunctionOrValue
type WriterFunctionOrValue = string | number | WriterFunction;
Package Files (1)
Dependencies (2)
Dev Dependencies (15)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ts-morph
.
- Markdown[](https://www.jsdocs.io/package/ts-morph)
- HTML<a href="https://www.jsdocs.io/package/ts-morph"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 27548 ms. - Missing or incorrect documentation? Open an issue for this package.