mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-05 00:32:41 -05:00
Added test and adjusted reporting logic.
This commit is contained in:
@@ -16382,7 +16382,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (isPotentiallyUncalledDecorator(node, callSignatures)) {
|
||||
error(node, Diagnostics.This_function_cannot_be_used_as_a_decorator_Did_you_mean_to_call_it_first);
|
||||
error(node, Diagnostics.This_value_has_type_0_which_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first, typeToString(funcType));
|
||||
return resolveErrorCall(node);
|
||||
}
|
||||
|
||||
@@ -16406,6 +16406,7 @@ namespace ts {
|
||||
function isPotentiallyUncalledDecorator(decorator: Decorator, signatures: Signature[]) {
|
||||
return signatures.length && every(signatures, signature =>
|
||||
signature.minArgumentCount === 0 &&
|
||||
!signature.hasRestParameter &&
|
||||
signature.parameters.length < getEffectiveArgumentCount(decorator, /*args*/ undefined, signature));
|
||||
}
|
||||
|
||||
|
||||
@@ -907,7 +907,7 @@
|
||||
"category": "Error",
|
||||
"code": 1328
|
||||
},
|
||||
"This function cannot be used as a decorator. Did you mean to call it first?": {
|
||||
"This value has type '{0}' which accepts too few arguments to be used as a decorator here. Did you mean to call it first?": {
|
||||
"category": "Error",
|
||||
"code": 1329
|
||||
},
|
||||
|
||||
0
src/compiler/emitter.ts
Executable file → Normal file
0
src/compiler/emitter.ts
Executable file → Normal file
Reference in New Issue
Block a user