diff options
Diffstat (limited to 'node_modules/tslint/lib/rules/noNonNullAssertionRule.js')
-rw-r--r-- | node_modules/tslint/lib/rules/noNonNullAssertionRule.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/node_modules/tslint/lib/rules/noNonNullAssertionRule.js b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js index dc657fc53..f9b2b7857 100644 --- a/node_modules/tslint/lib/rules/noNonNullAssertionRule.js +++ b/node_modules/tslint/lib/rules/noNonNullAssertionRule.js @@ -31,7 +31,7 @@ var Rule = /** @class */ (function (_super) { Rule.metadata = { ruleName: "no-non-null-assertion", description: "Disallows non-null assertions using the `!` postfix operator.", - rationale: "Using non-null assertion cancels the benefits of the strict null checking mode.", + rationale: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n Using non-null assertion cancels the benefits of the strict null checking mode.\n\n Instead of assuming objects exist:\n\n ```\n function foo(instance: MyClass | undefined) {\n instance!.doWork();\n }\n ```\n\n Either inform the strict type system that the object must exist:\n\n ```\n function foo(instance: MyClass) {\n instance.doWork();\n }\n ```\n\n Or verify that the instance exists, which will inform the type checker:\n\n ```\n function foo(instance: MyClass | undefined) {\n if (instance !== undefined) {\n instance.doWork();\n }\n }\n ```\n "], ["\n Using non-null assertion cancels the benefits of the strict null checking mode.\n\n Instead of assuming objects exist:\n\n \\`\\`\\`\n function foo(instance: MyClass | undefined) {\n instance!.doWork();\n }\n \\`\\`\\`\n\n Either inform the strict type system that the object must exist:\n\n \\`\\`\\`\n function foo(instance: MyClass) {\n instance.doWork();\n }\n \\`\\`\\`\n\n Or verify that the instance exists, which will inform the type checker:\n\n \\`\\`\\`\n function foo(instance: MyClass | undefined) {\n if (instance !== undefined) {\n instance.doWork();\n }\n }\n \\`\\`\\`\n "]))), optionsDescription: "Not configurable.", options: null, optionExamples: [true], @@ -51,3 +51,4 @@ function walk(ctx) { return ts.forEachChild(node, cb); }); } +var templateObject_1; |