diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 23da94437ae..c9d6c6949a9 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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); } diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 57dc9f28834..eb508857e6f 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -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 },