mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Did you forget to use await? for call and construct signatures
This commit is contained in:
parent
48fc6b8b17
commit
a3a076d79f
@ -22342,6 +22342,8 @@ namespace ts {
|
||||
function invocationErrorDetails(apparentType: Type, kind: SignatureKind): DiagnosticMessageChain {
|
||||
let errorInfo: DiagnosticMessageChain | undefined;
|
||||
const isCall = kind === SignatureKind.Call;
|
||||
const awaitedType = getAwaitedType(apparentType);
|
||||
const mightWorkWithAwait = awaitedType && getSignaturesOfType(awaitedType, kind).length > 0;
|
||||
if (apparentType.flags & TypeFlags.Union) {
|
||||
const types = (apparentType as UnionType).types;
|
||||
let hasSignatures = false;
|
||||
@ -22408,9 +22410,9 @@ namespace ts {
|
||||
}
|
||||
return chainDiagnosticMessages(
|
||||
errorInfo,
|
||||
isCall ?
|
||||
Diagnostics.This_expression_is_not_callable :
|
||||
Diagnostics.This_expression_is_not_constructable
|
||||
mightWorkWithAwait
|
||||
? isCall ? Diagnostics.This_expression_is_not_callable_Did_you_forget_to_use_await : Diagnostics.This_expression_is_not_constructable_Did_you_forget_to_use_await
|
||||
: isCall ? Diagnostics.This_expression_is_not_callable : Diagnostics.This_expression_is_not_constructable
|
||||
);
|
||||
}
|
||||
function invocationError(errorTarget: Node, apparentType: Type, kind: SignatureKind, relatedInformation?: DiagnosticRelatedInformation) {
|
||||
|
||||
@ -2705,50 +2705,58 @@
|
||||
"category": "Error",
|
||||
"code": 2775
|
||||
},
|
||||
"This expression is not callable. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2776
|
||||
},
|
||||
"This expression is not constructable. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2777
|
||||
},
|
||||
"The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2777
|
||||
},
|
||||
"Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2777
|
||||
},
|
||||
"Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2778
|
||||
},
|
||||
"Type '{0}' is not an array type. Did you forget to use 'await'?": {
|
||||
"Type '{0}' must have a '[Symbol.iterator]()' method that returns an iterator. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2779
|
||||
},
|
||||
"Type '{0}' is not an array type or a string type. Did you forget to use 'await'?": {
|
||||
"Type '{0}' must have a '[Symbol.asyncIterator]()' method that returns an async iterator. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2780
|
||||
},
|
||||
"Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator. Did you forget to use 'await'?": {
|
||||
"Type '{0}' is not an array type. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2781
|
||||
},
|
||||
"Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator. Did you forget to use 'await'?": {
|
||||
"Type '{0}' is not an array type or a string type. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2782
|
||||
},
|
||||
"Argument of type '{0}' is not assignable to parameter of type '{1}'. Did you forget to use 'await'?": {
|
||||
"Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2783
|
||||
},
|
||||
"Type '{0}' has no call signatures. Did you forget to use 'await'?": {
|
||||
"Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2784
|
||||
},
|
||||
"Type '{0}' has no construct signatures. Did you forget to use 'await'?": {
|
||||
"Argument of type '{0}' is not assignable to parameter of type '{1}'. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2785
|
||||
},
|
||||
"This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap. Did you forget to use 'await'?": {
|
||||
"Type '{0}' has no call signatures. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2786
|
||||
},
|
||||
"Type '{0}' has no construct signatures. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2787
|
||||
},
|
||||
"This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap. Did you forget to use 'await'?": {
|
||||
"category": "Error",
|
||||
"code": 2788
|
||||
},
|
||||
|
||||
"Import declaration '{0}' is using private name '{1}'.": {
|
||||
"category": "Error",
|
||||
|
||||
@ -24,4 +24,5 @@ async function fn(
|
||||
e();
|
||||
f();
|
||||
new g();
|
||||
b();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user