From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/tslint/lib/rules/awaitPromiseRule.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'node_modules/tslint/lib/rules/awaitPromiseRule.js') diff --git a/node_modules/tslint/lib/rules/awaitPromiseRule.js b/node_modules/tslint/lib/rules/awaitPromiseRule.js index cb1c35b08..c6eef346f 100644 --- a/node_modules/tslint/lib/rules/awaitPromiseRule.js +++ b/node_modules/tslint/lib/rules/awaitPromiseRule.js @@ -33,7 +33,7 @@ var Rule = /** @class */ (function (_super) { Rule.metadata = { ruleName: "await-promise", description: "Warns for an awaited value that is not a Promise.", - optionsDescription: (_a = ["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], _a.raw = ["\n A list of 'string' names of any additional classes that should also be handled as Promises.\n "], Lint.Utils.dedent(_a)), + optionsDescription: Lint.Utils.dedent(templateObject_1 || (templateObject_1 = tslib_1.__makeTemplateObject(["\n A list of 'string' names of any additional classes that should also be treated as Promises.\n For example, if you are using a class called 'Future' that implements the Thenable interface,\n you might tell the rule to consider type references with the name 'Future' as valid Promise-like\n types. Note that this rule doesn't check for type assignability or compatibility; it just checks\n type reference names.\n "], ["\n A list of 'string' names of any additional classes that should also be treated as Promises.\n For example, if you are using a class called 'Future' that implements the Thenable interface,\n you might tell the rule to consider type references with the name 'Future' as valid Promise-like\n types. Note that this rule doesn't check for type assignability or compatibility; it just checks\n type reference names.\n "]))), options: { type: "list", listType: { @@ -42,6 +42,7 @@ var Rule = /** @class */ (function (_super) { }, }, optionExamples: [true, [true, "Thenable"]], + rationale: Lint.Utils.dedent(templateObject_2 || (templateObject_2 = tslib_1.__makeTemplateObject(["\n While it is valid JavaScript to await a non-Promise-like value (it will resolve immediately),\n this pattern is often a programmer error and the resulting semantics can be unintuitive.\n\n Awaiting non-Promise-like values often is an indication of programmer error, such as\n forgetting to add parenthesis to call a function that returns a Promise.\n "], ["\n While it is valid JavaScript to await a non-Promise-like value (it will resolve immediately),\n this pattern is often a programmer error and the resulting semantics can be unintuitive.\n\n Awaiting non-Promise-like values often is an indication of programmer error, such as\n forgetting to add parenthesis to call a function that returns a Promise.\n "]))), type: "functionality", typescriptOnly: true, requiresTypeInfo: true, @@ -70,8 +71,13 @@ function walk(ctx, tc) { } } function containsType(type, predicate) { - if (Lint.isTypeFlagSet(type, ts.TypeFlags.Any) || - tsutils_1.isTypeReference(type) && type.target.symbol !== undefined && predicate(type.target.symbol.name)) { + if (tsutils_1.isTypeFlagSet(type, ts.TypeFlags.Any)) { + return true; + } + if (tsutils_1.isTypeReference(type)) { + type = type.target; + } + if (type.symbol !== undefined && predicate(type.symbol.name)) { return true; } if (tsutils_1.isUnionOrIntersectionType(type)) { @@ -83,4 +89,4 @@ function containsType(type, predicate) { function isAsyncIterable(name) { return name === "AsyncIterable" || name === "AsyncIterableIterator"; } -var _a; +var templateObject_1, templateObject_2; -- cgit v1.2.3