aboutsummaryrefslogtreecommitdiff
path: root/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/tslint/lib/rules/restrictPlusOperandsRule.js')
-rw-r--r--node_modules/tslint/lib/rules/restrictPlusOperandsRule.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
index 930ce2892..1974ce47a 100644
--- a/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
+++ b/node_modules/tslint/lib/rules/restrictPlusOperandsRule.js
@@ -20,13 +20,13 @@ var tslib_1 = require("tslib");
var tsutils_1 = require("tsutils");
var ts = require("typescript");
var Lint = require("../index");
-var Rule = (function (_super) {
+var Rule = /** @class */ (function (_super) {
tslib_1.__extends(Rule, _super);
function Rule() {
return _super !== null && _super.apply(this, arguments) || this;
}
Rule.prototype.applyWithProgram = function (sourceFile, program) {
- return this.applyWithFunction(sourceFile, function (ctx) { return walk(ctx, program); });
+ return this.applyWithFunction(sourceFile, walk, undefined, program.getTypeChecker());
};
/* tslint:disable:object-literal-sort-keys */
Rule.metadata = {
@@ -44,10 +44,9 @@ var Rule = (function (_super) {
return Rule;
}(Lint.Rules.TypedRule));
exports.Rule = Rule;
-function walk(ctx, program) {
+function walk(ctx, tc) {
return ts.forEachChild(ctx.sourceFile, function cb(node) {
if (tsutils_1.isBinaryExpression(node) && node.operatorToken.kind === ts.SyntaxKind.PlusToken) {
- var tc = program.getTypeChecker();
var leftType = getBaseTypeOfLiteralType(tc.getTypeAtLocation(node.left));
var rightType = getBaseTypeOfLiteralType(tc.getTypeAtLocation(node.right));
if (leftType === "invalid" || rightType === "invalid" || leftType !== rightType) {