UNPKG

alm

Version:

The best IDE for TypeScript

36 lines (35 loc) 1.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var EqualsToEquals = /** @class */ (function () { function EqualsToEquals() { this.key = EqualsToEquals.name; } EqualsToEquals.prototype.canProvideFix = function (info) { if (info.positionNode.kind === ts.SyntaxKind.EqualsEqualsToken) { return { display: "Convert == to ===" }; } if (info.positionNode.kind === ts.SyntaxKind.ExclamationEqualsToken) { return { display: "Convert != to !==" }; } }; EqualsToEquals.prototype.provideFix = function (info) { if (info.positionNode.kind === ts.SyntaxKind.EqualsEqualsToken) { var newText = '==='; } if (info.positionNode.kind === ts.SyntaxKind.ExclamationEqualsToken) { var newText = '!=='; } var refactoring = { span: { // Since TypeScript stores trivia at with the node `pos` we only want 2 steps behind the `end` instead of `pos` start: info.positionNode.end - 2, length: 2 }, newText: newText, filePath: info.filePath }; return [refactoring]; }; return EqualsToEquals; }()); exports.EqualsToEquals = EqualsToEquals;