Skip to content

Commit 8f54cb6

Browse files
committed
Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/eslint
2 parents 828ebd5 + 984956a commit 8f54cb6

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

src/compiler/checker.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24033,7 +24033,11 @@ namespace ts {
2403324033
}
2403424034

2403524035
const operandType = checkExpression(node.expression);
24036-
return checkAwaitedType(operandType, node, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
24036+
const awaitedType = checkAwaitedType(operandType, node, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
24037+
if (awaitedType === operandType && awaitedType !== errorType && !(operandType.flags & TypeFlags.AnyOrUnknown)) {
24038+
addErrorOrSuggestion(/*isError*/ false, createDiagnosticForNode(node, Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
24039+
}
24040+
return awaitedType;
2403724041
}
2403824042

2403924043
function checkPrefixUnaryExpression(node: PrefixUnaryExpression): Type {
@@ -26537,9 +26541,6 @@ namespace ts {
2653726541
*/
2653826542
function checkAwaitedType(type: Type, errorNode: Node, diagnosticMessage: DiagnosticMessage, arg0?: string | number): Type {
2653926543
const awaitedType = getAwaitedType(type, errorNode, diagnosticMessage, arg0);
26540-
if (awaitedType === type && !(type.flags & TypeFlags.AnyOrUnknown)) {
26541-
addErrorOrSuggestion(/*isError*/ false, createDiagnosticForNode(errorNode, Diagnostics.await_has_no_effect_on_the_type_of_this_expression));
26542-
}
2654326544
return awaitedType || errorType;
2654426545
}
2654526546

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @target: esnext
4+
////async function fn(): Promise<number> {
5+
//// return 0;
6+
////}
7+
8+
verify.getSuggestionDiagnostics([]);

0 commit comments

Comments
 (0)