[feature request] Better error messages for decorators (they are completely not understandable) #39991
Open
5 tasks done
Labels
Bug
A bug in TypeScript
Domain: Error Messages
The issue relates to error messaging
Effort: Moderate
Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".
Help Wanted
You can do this
Milestone
Search Terms
"Unable to resolve signature of property decorator when called as an expression"
Suggestion
The error message I received was
error TS1240: Unable to resolve signature of property decorator when called as an expression.
This leaves absolutely no clue what is wrong.
Examples
To fix the issue, I had to change the signature of one of my functions from
to
The difference is subtle: the
descriptor
arg isn't always passed to a decorator (depends on whether it is used on a property or on an accessor or method).It'd be better if the message said something like
The 'descriptor' argument to a property decorator should not be required.
Similar for other cases that trigger the same unhelpful error message.
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: