1/* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16import ts from "typescript"; 17 18export function getSymbol(node: ts.Node): ts.Symbol; 19export function tsStringToString(str: ts.__String): string; 20export function getTextOfIdentifierOrLiteral(node: ts.Node): string; 21export function isJsFile(file: ts.SourceFile): boolean; 22export function createEmptyNodeArray<T extends ts.Node>(): ts.NodeArray<T>; 23export function getFlowNode(stmt: ts.Statement): ts.Node; 24export function bindSourceFile(sourceFile: ts.SourceFile, options: ts.CompilerOptions); 25export function createDiagnosticForNode(node: ts.Node, message: ts.DiagnosticMessage, ...args: (string | number | undefined)[]): ts.DiagnosticWithLocation; 26export function createCompilerDiagnostic(message: ts.DiagnosticMessage, ...args: (string | number | undefined)[]): ts.Diagnostic; 27export function createFileDiagnostic(file: ts.SourceFile, start: number, length: number, message: ts.DiagnosticMessage, 28 ...args: (string | number | undefined)[]): ts.DiagnosticWithLocation; 29export function isEffectiveStrictModeSourceFile(node: ts.SourceFile, compilerOptions: ts.CompilerOptions): boolean; 30export function getErrorSpanForNode(sourceFile: ts.SourceFile, node: ts.Node): ts.TextSpan; 31export function getSpanOfTokenAtPosition(sourceFile: ts.SourceFile, pos: number): ts.TextSpan; 32export function getContainingClass(node: ts.Node): ts.ClassLikeDeclaration | undefined; 33export function declarationNameToString(name: ts.DeclarationName | ts.QualifiedName | undefined); 34export function getContainingFunction(node: ts.Node): ts.SignatureDeclaration | undefined; 35export function isPrologueDirective(node: ts.Node): node is ts.PrologueDirective; 36export function getSourceTextOfNodeFromSourceFile(sourceFile: ts.SourceFile, node: ts.Node, includeTrivia = false): string; 37export function isAssignmentTarget(node: ts.Node): boolean; 38export function getSourceFileOfNode(node: ts.Node): ts.SourceFile; 39export function isIterationStatement(node: ts.Node, lookInLabeledStatements: boolean): node is ts.IterationStatement; 40export function getTextOfNode(node: ts.Node, includeTrivia = false): string; 41export function nodePosToString(node: ts.Node): string; 42export function getContainingFunctionDeclaration(node: ts.Node): ts.FunctionLikeDeclaration | undefined; 43export function tokenToString(t: ts.SyntaxKind): string | undefined; 44export function getNewTargetContainer(node: ts.Node): ts.Node | undefined; 45export function isVarConst(node: ts.VariableDeclaration | ts.VariableDeclarationList): boolean; 46export function isLet(node: ts.Node): boolean; 47export function nodeCanBeDecorated(node: ts.Node, parent?: ts.Node, grandparent?: ts.Node): boolean; 48export function getAllAccessorDeclarations(declarations: readonly ts.Declaration[], accessor: ts.AccessorDeclaration): ts.AllAccessorDeclarations; 49export function nodeIsPresent(node: ts.Node | undefined): boolean; 50export function modifierToFlag(token: ts.SyntaxKind): ts.ModifierFlags; 51export function hasSyntacticModifier(node: ts.Node, flags: ts.ModifierFlags): boolean; 52export function isAmbientModule(node: ts.Node): node is ts.AmbientModuleDeclaration; 53export function isKeyword(token: ts.SyntaxKind): boolean; 54export function getThisContainer(node: ts.Node, includeArrowFunctions: boolean): ts.Node; 55export function getEnclosingBlockScopeContainer(node: ts.Node): ts.Node; 56export function findAncestor(node: ts.Node | undefined, callback: (element: ts.Node) => boolean | "quit"): ts.Node | undefined; 57export function isBlockScope(node: ts.Node, parentNode: ts.Node): boolean; 58export function isIdentifierName(node: ts.Identifier): boolean; 59export function declarationNameToString(name: ts.DeclarationName | ts.QualifiedName | undefined): string; 60export function isInTopLevelContext(node: ts.Node); 61export function isExternalOrCommonJsModule(file: ts.SourceFile): boolean; 62export function skipParentheses(node: ts.Node): ts.Node; 63export function getImmediatelyInvokedFunctionExpression(func: ts.Node): ts.CallExpression | undefined; 64export function hasQuestionToken(node: ts.Node); 65export function getPropertyNameForPropertyNameNode(name: ts.PropertyName): ts.__String | undefined; 66export function isFunctionBlock(node: ts.Node): boolean; 67export function isFunctionLike(node: ts.Node): boolean; 68export function getSuperContainer(node: ts.Node, stopOnFunctions: boolean): ts.Node; 69export function getClassExtendsHeritageElement(node: ts.ClassLikeDeclaration | ts.InterfaceDeclaration); 70export function hasStaticModifier(node: ts.Node): boolean; 71export function skipOuterExpressions(node: ts.Node, kinds?: ts.OuterExpressionKinds): ts.Node; 72export function isSuperCall(n: ts.Node); 73export function isThisProperty(node: ts.Node): boolean; 74export function isThisIdentifier(node: ts.Node | undefined): boolean; 75export function isSuperProperty(node: ts.Node); 76export function setParent<T extends ts.Node>(child: T | undefined, parent: T["parent"] | undefined): T | undefined;