UNPKG

ts-simple-ast

Version:

TypeScript compiler wrapper for AST navigation and code generation.

42 lines (40 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Node_1 = require("./Node"); class Identifier extends Node_1.Node { /** * Gets the text for the identifier. */ getText() { return this.compilerNode.text; } /** * Renames the identifier. * @param newName - New name of the identifier. */ rename(newName) { this.global.languageService.renameNode(this, newName); } /** * Finds all the references of this identifier. */ findReferences() { return this.global.languageService.findReferences(this.sourceFile, this); } /** * Gets the definitions of the current identifier. * * This is similar to "go to definition". */ getDefinitions() { return this.global.languageService.getDefinitions(this.sourceFile, this); } /** * Gets the type of the identifier. */ getType() { return this.global.typeChecker.getTypeAtLocation(this); } } exports.Identifier = Identifier; //# sourceMappingURL=Identifier.js.map