import { IUpdaterBase } from "./i-updater"; import { AsteriskToken, Block, CallExpression, ClassDeclaration, ClassElement, ClassExpression, ConstructorDeclaration, Decorator, ExportDeclaration, ExportSpecifier, Expression, GetAccessorDeclaration, HeritageClause, Identifier, ImportClause, ImportDeclaration, ImportSpecifier, LeftHandSideExpression, MethodDeclaration, ModifiersArray, NamedExports, NamedImports, NamespaceImport, Node, NodeArray, ParameterDeclaration, PropertyDeclaration, PropertyName, QuestionToken, SetAccessorDeclaration, SourceFile, Statement, TypeNode, TypeParameterDeclaration } from "typescript"; import { ITypescriptLanguageService } from "@wessberg/typescript-language-service"; import { INodeUpdaterUtil } from "@wessberg/typescript-ast-util"; /** * A class for updating nodes */ export declare class Updater implements IUpdaterBase { private readonly languageService; private readonly nodeUpdater; constructor(languageService: ITypescriptLanguageService, nodeUpdater: INodeUpdaterUtil); /** * Updates the body property of a GetAccessorDeclaration * @param {Block} body * @param {GetAccessorDeclaration} getter * @returns {GetAccessorDeclaration} */ updateGetAccessorDeclarationBody(body: Block | undefined, getter: GetAccessorDeclaration): GetAccessorDeclaration; /** * Updates the name property of a GetAccessorDeclaration * @param {PropertyName} name * @param {GetAccessorDeclaration} getter * @returns {GetAccessorDeclaration} */ updateGetAccessorDeclarationName(name: PropertyName, getter: GetAccessorDeclaration): GetAccessorDeclaration; /** * Updates the parameters property of a GetAccessorDeclaration * @param {NodeArray} parameters * @param {GetAccessorDeclaration} getter * @returns {GetAccessorDeclaration} */ updateGetAccessorDeclarationParameters(parameters: NodeArray, getter: GetAccessorDeclaration): GetAccessorDeclaration; /** * Updates the type property of a GetAccessorDeclaration * @param {TypeNode} type * @param {GetAccessorDeclaration} getter * @returns {GetAccessorDeclaration} */ updateGetAccessorDeclarationType(type: TypeNode | undefined, getter: GetAccessorDeclaration): GetAccessorDeclaration; /** * Updates the modifiers property of a GetAccessorDeclaration * @param {ModifiersArray} modifiers * @param {GetAccessorDeclaration} getter * @returns {GetAccessorDeclaration} */ updateGetAccessorDeclarationModifiers(modifiers: ModifiersArray | undefined, getter: GetAccessorDeclaration): GetAccessorDeclaration; /** * Updates the body property of a SetAccessorDeclaration * @param {Block} body * @param {SetAccessorDeclaration} setter * @returns {SetAccessorDeclaration} */ updateSetAccessorDeclarationBody(body: Block | undefined, setter: SetAccessorDeclaration): SetAccessorDeclaration; /** * Updates the name property of a SetAccessorDeclaration * @param {PropertyName} name * @param {SetAccessorDeclaration} setter * @returns {SetAccessorDeclaration} */ updateSetAccessorDeclarationName(name: PropertyName, setter: SetAccessorDeclaration): SetAccessorDeclaration; /** * Updates the parameters property of a SetAccessorDeclaration * @param {NodeArray} parameters * @param {SetAccessorDeclaration} setter * @returns {SetAccessorDeclaration} */ updateSetAccessorDeclarationParameters(parameters: NodeArray, setter: SetAccessorDeclaration): SetAccessorDeclaration; /** * Updates the modifiers property of a SetAccessorDeclaration * @param {ModifiersArray} modifiers * @param {SetAccessorDeclaration} setter * @returns {SetAccessorDeclaration} */ updateSetAccessorDeclarationModifiers(modifiers: ModifiersArray | undefined, setter: SetAccessorDeclaration): SetAccessorDeclaration; /** * Updates the exportClause property of an ExportDeclaration * @param {NamedExports} exportClause * @param {ExportDeclaration} exportDeclaration * @returns {ExportDeclaration} */ updateExportDeclarationExportClause(exportClause: NamedExports | undefined, exportDeclaration: ExportDeclaration): ExportDeclaration; /** * Updates the moduleSpecifier property of an ExportDeclaration * @param {Expression} moduleSpecifier * @param {ExportDeclaration} exportDeclaration * @returns {ExportDeclaration} */ updateExportDeclarationModuleSpecifier(moduleSpecifier: Expression | undefined, exportDeclaration: ExportDeclaration): ExportDeclaration; /** * Updates the modifiers property of an ExportDeclaration * @param {ModifiersArray} modifiers * @param {ExportDeclaration} exportDeclaration * @returns {ExportDeclaration} */ updateExportDeclarationModifiers(modifiers: ModifiersArray | undefined, exportDeclaration: ExportDeclaration): ExportDeclaration; /** * Updates the expression property of a CallExpression * @param {LeftHandSideExpression} expression * @param {CallExpression} callExpression * @returns {CallExpression} */ updateCallExpressionExpression(expression: LeftHandSideExpression, callExpression: CallExpression): CallExpression; /** * Updates the typeArguments property of a CallExpression * @param {NodeArray} typeArguments * @param {CallExpression} callExpression * @returns {CallExpression} */ updateCallExpressionTypeArguments(typeArguments: NodeArray | undefined, callExpression: CallExpression): CallExpression; /** * Updates the arguments property of a CallExpression * @param {NodeArray} args * @param {CallExpression} callExpression * @returns {CallExpression} */ updateCallExpressionArguments(args: NodeArray, callExpression: CallExpression): CallExpression; /** * Updates the questionToken property of a PropertyDeclaration * @param {QuestionToken} questionToken * @param {PropertyDeclaration} property * @returns {PropertyDeclaration} */ updatePropertyDeclarationQuestionToken(questionToken: QuestionToken | undefined, property: PropertyDeclaration): PropertyDeclaration; /** * Updates the name property of a PropertyDeclaration * @param {PropertyName} name * @param {PropertyDeclaration} property * @returns {PropertyDeclaration} */ updatePropertyDeclarationName(name: PropertyName, property: PropertyDeclaration): PropertyDeclaration; /** * Updates the type property of a PropertyDeclaration * @param {TypeNode} type * @param {PropertyDeclaration} property * @returns {PropertyDeclaration} */ updatePropertyDeclarationType(type: TypeNode | undefined, property: PropertyDeclaration): PropertyDeclaration; /** * Updates the initializer property of a PropertyDeclaration * @param {Expression} initializer * @param {PropertyDeclaration} property * @returns {PropertyDeclaration} */ updatePropertyDeclarationInitializer(initializer: Expression | undefined, property: PropertyDeclaration): PropertyDeclaration; /** * Updates the decorators property of the given Node * @param {ts.NodeArray} decorators * @param {T} node * @returns {T} */ updateNodeDecorators(decorators: NodeArray | undefined, node: T): T; /** * Updates the modifiers property of the given Node * @param {ModifiersArray} modifiers * @param {T} node * @returns {T} */ updateNodeModifiers(modifiers: ModifiersArray | undefined, node: T): T; /** * Updates the modifiers property of a PropertyDeclaration * @param {ModifiersArray} modifiers * @param {PropertyDeclaration} property * @returns {PropertyDeclaration} */ updatePropertyDeclarationModifiers(modifiers: ModifiersArray | undefined, property: PropertyDeclaration): PropertyDeclaration; /** * Replaces a Node with the new one * @param {T} newNode * @param {T} existing * @returns {T} */ replace(newNode: T, existing: T): T; /** * Updates the statements property of a SourceFile * @param {NodeArray} statements * @param {SourceFile} sourceFile * @returns {SourceFile} */ updateSourceFileStatements(statements: NodeArray, sourceFile: SourceFile): SourceFile; /** * Updates the name property of a NamespaceImport * @param {Identifier} name * @param {NamespaceImport} namespaceImport * @returns {NamespaceImport} */ updateNamespaceImportName(name: Identifier, namespaceImport: NamespaceImport): NamespaceImport; /** * Updates the elements property of a NamedImports * @param {NodeArray} elements * @param {NamedImports} namedImports * @returns {NamedImports} */ updateNamedImportsElements(elements: NodeArray, namedImports: NamedImports): NamedImports; /** * Updates the elements property of a NamedExports * @param {NodeArray} elements * @param {NamedExports} namedExports * @returns {NamedExports} */ updateNamedExportsElements(elements: NodeArray, namedExports: NamedExports): NamedExports; /** * Updates the modifiers property of an ImportDeclaration * @param {ModifiersArray} modifiers * @param {ImportDeclaration} importDeclaration * @returns {ImportDeclaration} */ updateImportDeclarationModifiers(modifiers: ModifiersArray | undefined, importDeclaration: ImportDeclaration): ImportDeclaration; /** * Updates the importClause property of an ImportDeclaration * @param {ImportClause?} importClause * @param {ImportDeclaration} importDeclaration * @returns {ImportDeclaration} */ updateImportDeclarationImportClause(importClause: ImportClause | undefined, importDeclaration: ImportDeclaration): ImportDeclaration; /** * Updates the moduleSpecifier property of an ImportDeclaration * @param {Expression} moduleSpecifier * @param {ImportDeclaration} importDeclaration * @returns {ImportDeclaration} */ updateImportDeclarationModuleSpecifier(moduleSpecifier: Expression, importDeclaration: ImportDeclaration): ImportDeclaration; /** * Updates the name property of a MethodDeclaration * @param {PropertyName} name * @param {MethodDeclaration} method * @returns {MethodDeclaration} */ updateMethodDeclarationName(name: PropertyName, method: MethodDeclaration): MethodDeclaration; /** * Updates the asteriskToken property of a MethodDeclaration * @param {AsteriskToken} asteriskToken * @param {MethodDeclaration} method * @returns {MethodDeclaration} */ updateMethodDeclarationAsteriskToken(asteriskToken: AsteriskToken | undefined, method: MethodDeclaration): MethodDeclaration; /** * Updates the questionToken property of a MethodDeclaration * @param {QuestionToken} questionToken * @param {MethodDeclaration} method * @returns {MethodDeclaration} */ updateMethodDeclarationQuestionToken(questionToken: QuestionToken | undefined, method: MethodDeclaration): MethodDeclaration; /** * Updates the typeParameters property of a MethodDeclaration * @param {NodeArray} typeParameters * @param {MethodDeclaration} method * @returns {MethodDeclaration} */ updateMethodDeclarationTypeParameters(typeParameters: NodeArray | undefined, method: MethodDeclaration): MethodDeclaration; /** * Updates the parameters property of a MethodDeclaration * @param {NodeArray} parameters * @param {MethodDeclaration} method * @returns {MethodDeclaration} */ updateMethodDeclarationParameters(parameters: NodeArray, method: MethodDeclaration): MethodDeclaration; /** * Updates the type property of a MethodDeclaration * @param {TypeNode} type * @param {MethodDeclaration} method * @returns {MethodDeclaration} */ updateMethodDeclarationType(type: TypeNode | undefined, method: MethodDeclaration): MethodDeclaration; /** * Updates the modifiers property of a MethodDeclaration * @param {ModifiersArray} modifiers * @param {MethodDeclaration} method * @returns {MethodDeclaration} */ updateMethodDeclarationModifiers(modifiers: ModifiersArray | undefined, method: MethodDeclaration): MethodDeclaration; /** * Updates the asteriskToken property of a ConstructorDeclaration * @param {AsteriskToken} asteriskToken * @param {ConstructorDeclaration} constructor * @returns {ConstructorDeclaration} */ updateConstructorDeclarationAsteriskToken(asteriskToken: AsteriskToken | undefined, constructor: ConstructorDeclaration): ConstructorDeclaration; /** * Updates the questionToken property of a ConstructorDeclaration * @param {QuestionToken} questionToken * @param {ConstructorDeclaration} constructor * @returns {ConstructorDeclaration} */ updateConstructorDeclarationQuestionToken(questionToken: QuestionToken | undefined, constructor: ConstructorDeclaration): ConstructorDeclaration; /** * Updates the typeParameters property of a ConstructorDeclaration * @param {NodeArray} typeParameters * @param {ConstructorDeclaration} constructor * @returns {ConstructorDeclaration} */ updateConstructorDeclarationTypeParameters(typeParameters: NodeArray | undefined, constructor: ConstructorDeclaration): ConstructorDeclaration; /** * Updates the parameters property of a ConstructorDeclaration * @param {NodeArray} parameters * @param {ConstructorDeclaration} constructor * @returns {ConstructorDeclaration} */ updateConstructorDeclarationParameters(parameters: NodeArray, constructor: ConstructorDeclaration): ConstructorDeclaration; /** * Updates the type property of a ConstructorDeclaration * @param {TypeNode} type * @param {ConstructorDeclaration} constructor * @returns {ConstructorDeclaration} */ updateConstructorDeclarationType(type: TypeNode | undefined, constructor: ConstructorDeclaration): ConstructorDeclaration; /** * Updates the modifiers property of a ConstructorDeclaration * @param {ModifiersArray} modifiers * @param {ConstructorDeclaration} constructor * @returns {ConstructorDeclaration} */ updateConstructorDeclarationModifiers(modifiers: ModifiersArray | undefined, constructor: ConstructorDeclaration): ConstructorDeclaration; /** * Updates the Body of a MethodDeclaration * @param {Block} body * @param {MethodDeclaration} method * @returns {MethodDeclaration} */ updateMethodDeclarationBody(body: Block | undefined, method: MethodDeclaration): MethodDeclaration; /** * Updates the Body of a ConstructorDeclaration * @param {Block} body * @param {ConstructorDeclaration} constructor * @returns {ConstructorDeclaration} */ updateConstructorDeclarationBody(body: Block | undefined, constructor: ConstructorDeclaration): ConstructorDeclaration; /** * Updates the TypeParameters of a class * @param {NodeArray} typeParameters * @param {T} classDeclaration * @returns {T} */ updateClassDeclarationTypeParameters(typeParameters: NodeArray | undefined, classDeclaration: T): T; /** * Updates the ClassMembers of a class * @param {NodeArray} members * @param {T} classDeclaration * @returns {T} */ updateClassDeclarationMembers(members: NodeArray | undefined, classDeclaration: T): T; /** * Updates the name of a class * @param {Identifier?} name * @param {T} classDeclaration * @returns {T} */ updateClassDeclarationName(name: Identifier | undefined, classDeclaration: T): T; /** * Updates the HeritageClauses of a class * @param {NodeArray?} heritageClauses * @param {T} classDeclaration * @returns {T} */ updateClassDeclarationHeritageClauses(heritageClauses: NodeArray | undefined, classDeclaration: T): T; /** * Updates the Modifiers of a class * @param {ModifiersArray?} modifiers * @param {T} classDeclaration * @returns {T} */ updateClassDeclarationModifiers(modifiers: ModifiersArray | undefined, classDeclaration: T): T; /** * Updates a ClassDeclaration * @param {string} key * @param {*} value * @param {T} classDeclaration * @returns {T} */ private updateClassDeclaration; /** * Updates a MethodDeclaration * @param {string} key * @param {*} value * @param {MethodDeclaration} method * @returns {MethodDeclaration} */ private updateMethodDeclaration; /** * Updates a GetAccessorDeclaration * @param {string} key * @param {*} value * @param {GetAccessorDeclaration} getter * @returns {GetAccessorDeclaration} */ private updateGetAccessorDeclaration; /** * Updates a SetAccessorDeclaration * @param {string} key * @param {*} value * @param {SetAccessorDeclaration} setter * @returns {SetAccessorDeclaration} */ private updateSetAccessorDeclaration; /** * Updates a PropertyDeclaration * @param {string} key * @param {*} value * @param {PropertyDeclaration} property * @returns {PropertyDeclaration} */ private updatePropertyDeclaration; /** * Updates a ConstructorDeclaration * @param {string} key * @param {*} value * @param {ConstructorDeclaration} constructor * @returns {ConstructorDeclaration} */ private updateConstructorDeclaration; /** * Updates a CallExpression * @param {string} key * @param {*} value * @param {CallExpression} callExpression * @returns {CallExpression} */ private updateCallExpression; /** * Updates an ImportDeclaration * @param {string} key * @param {*} value * @param {ImportDeclaration} importDeclaration * @returns {ImportDeclaration} */ private updateImportDeclaration; /** * Updates an ExportDeclaration * @param {string} key * @param {*} value * @param {ExportDeclaration} exportDeclaration * @returns {ExportDeclaration} */ private updateExportDeclaration; /** * Updates a NamedImports * @param {string} key * @param {*} value * @param {NamedImports} namedImports * @returns {NamedImports} */ private updateNamedImports; /** * Updates a NamedExports * @param {string} key * @param {*} value * @param {NamedExports} namedExports * @returns {NamedExports} */ private updateNamedExports; /** * Updates a NamespaceImport * @param {string} key * @param {*} value * @param {NamespaceImport} namespaceImport * @returns {NamespaceImport} */ private updateNamespaceImport; /** * Updates a SourceFile * @param {string} key * @param {*} value * @param {SourceFile} sourceFile * @returns {SourceFile} */ private updateSourceFile; }