mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-07 14:34:35 -06:00
Improve error message for uncalled decorators.
This commit is contained in:
parent
803b5660fc
commit
96bb796730
@ -16382,7 +16382,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (isPotentiallyUncalledDecorator(node, callSignatures)) {
|
||||
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));
|
||||
const printer = createPrinter({ removeComments: true });
|
||||
const nodeStr = printer.printNode(EmitHint.Expression, node.expression, getSourceFileOfNode(node));
|
||||
error(node, Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0, nodeStr);
|
||||
return resolveErrorCall(node);
|
||||
}
|
||||
|
||||
|
||||
@ -907,7 +907,7 @@
|
||||
"category": "Error",
|
||||
"code": 1328
|
||||
},
|
||||
"This value has type '{0}' which accepts too few arguments to be used as a decorator here. Did you mean to call it first?": {
|
||||
"'{0}' accepts too few arguments to be used as a decorator here. Did you mean to call it first and write '@{0}()'?": {
|
||||
"category": "Error",
|
||||
"code": 1329
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user