Skip to content

Improved error message. #11750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

SebastienCaunes
Copy link

Inspired by this issue
#4534
And adding the tip that this message arise when forgetting parenthesis on a decorator. Frequent error when using Angular :

@Input
myVar:MyVar;

@msftclas
Copy link

Hi @SebastienCaunes, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. Real humans will now evaluate your PR.

TTYL, MSBOT;

@SebastienCaunes
Copy link
Author

Another one experiencing angular problem with decorators
http://stackoverflow.com/questions/40083195/angular-2-service-error-cannot-find-cause

@RyanCavanaugh
Copy link
Member

When you change diagnosticMessages.json, you need to run the generate-diagnostics task and also commit the changes to the .generated.js file (as well as update any compiler sources which reference the error)

@@ -763,7 +763,7 @@
"category": "Error",
"code": 1239
},
"Unable to resolve signature of property decorator when called as an expression.": {
"Expression type is not assignable to decorator type. Check type of parameters, or missing ().": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say this is not the right place to fix this issue. in checker.ts in resolveDecorator we can check if the signatures did not match, and the decorator node is not a call expression (i.e. @dec vs @dec(..)) we can add an explanation message to say something like have you forgot to call it?.

@mhegazy
Copy link
Contributor

mhegazy commented Dec 22, 2016

Closing for now. feel free to create a new PR with the proposed changes.

@mhegazy mhegazy closed this Dec 22, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants