diff options
Diffstat (limited to 'node_modules/tslint/lib/rules/noAnyRule.js')
-rw-r--r-- | node_modules/tslint/lib/rules/noAnyRule.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/node_modules/tslint/lib/rules/noAnyRule.js b/node_modules/tslint/lib/rules/noAnyRule.js index d438dabca..bd424bf9f 100644 --- a/node_modules/tslint/lib/rules/noAnyRule.js +++ b/node_modules/tslint/lib/rules/noAnyRule.js @@ -32,7 +32,7 @@ var Rule = /** @class */ (function (_super) { ruleName: "no-any", description: "Disallows usages of `any` as a type declaration.", hasFix: false, - rationale: "Using `any` as a type declaration nullifies the compile-time benefits of the type system.", + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using `any` as a type declaration nullifies the compile-time benefits of the type system.\n\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type `{}`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use `<T>` template types for generic type handling.\n\n Also see the `no-unsafe-any` rule.\n "], ["\n Using \\`any\\` as a type declaration nullifies the compile-time benefits of the type system.\n\n If you're dealing with data of unknown or \"any\" types, you shouldn't be accessing members of it.\n Either add type annotations for properties that may exist or change the data type to the empty object type \\`{}\\`.\n\n Alternately, if you're creating storage or handling for consistent but unknown types, such as in data structures\n or serialization, use \\`<T>\\` template types for generic type handling.\n\n Also see the \\`no-unsafe-any\\` rule.\n "]))), optionsDescription: "Not configurable.", options: null, optionExamples: [true], @@ -40,9 +40,7 @@ var Rule = /** @class */ (function (_super) { typescriptOnly: true, }; /* tslint:enable:object-literal-sort-keys */ - Rule.FAILURE_STRING = "Type declaration of 'any' loses type-safety. " + - "Consider replacing it with a more precise type, the empty type ('{}'), " + - "or suppress this occurrence."; + Rule.FAILURE_STRING = "Type declaration of 'any' loses type-safety. Consider replacing it with a more precise type."; return Rule; }(Lint.Rules.AbstractRule)); exports.Rule = Rule; @@ -50,8 +48,9 @@ function walk(ctx) { return ts.forEachChild(ctx.sourceFile, function cb(node) { if (node.kind === ts.SyntaxKind.AnyKeyword) { var start = node.end - 3; - return ctx.addFailure(start, node.end, Rule.FAILURE_STRING, new Lint.Replacement(start, 3, "{}")); + return ctx.addFailure(start, node.end, Rule.FAILURE_STRING); } return ts.forEachChild(node, cb); }); } +var templateObject_1; |