Skip to content

Commit 1fd9de3

Browse files
committed
do not suggest to mark constructor 'async'
1 parent 8e9556a commit 1fd9de3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23093,7 +23093,7 @@ namespace ts {
2309323093
const span = getSpanOfTokenAtPosition(sourceFile, node.pos);
2309423094
const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.await_expression_is_only_allowed_within_an_async_function);
2309523095
const func = getContainingFunction(node);
23096-
if (func) {
23096+
if (func && func.kind !== SyntaxKind.Constructor) {
2309723097
Debug.assert((getFunctionFlags(func) & FunctionFlags.Async) === 0, "Enclosing function should never be an async function.");
2309823098
const relatedInfo = createDiagnosticForNode(func, Diagnostics.Did_you_mean_to_mark_this_function_as_async);
2309923099
addRelatedInfo(diagnostic, relatedInfo);
@@ -31603,7 +31603,7 @@ namespace ts {
3160331603
if (!hasParseDiagnostics(sourceFile)) {
3160431604
const diagnostic = createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
3160531605
const func = getContainingFunction(forInOrOfStatement);
31606-
if (func) {
31606+
if (func && func.kind !== SyntaxKind.Constructor) {
3160731607
Debug.assert((getFunctionFlags(func) & FunctionFlags.Async) === 0, "Enclosing function should never be an async function.");
3160831608
const relatedInfo = createDiagnosticForNode(func, Diagnostics.Did_you_mean_to_mark_this_function_as_async);
3160931609
addRelatedInfo(diagnostic, relatedInfo);

0 commit comments

Comments
 (0)