Improve error message for uncalled decorators.

This commit is contained in:
Daniel Rosenwasser 2017-10-02 17:56:10 -07:00
parent 803b5660fc
commit 96bb796730
2 changed files with 4 additions and 2 deletions

View File

@ -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);
}

View File

@ -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
},