Typescript: Can we give better error messages on invoked accessors?

Created on 1 Jun 2018  ยท  7Comments  ยท  Source: microsoft/TypeScript

Bug Error Messages Fixed good first issue help wanted

Most helpful comment

Man I like the passion to immediately convert some feedback on Twitter into a GitHub issue. What I really like in cases like this is _"Did you mean...?"_ types of error feedback (showing the same surrounding code from the user, but modified). I personally also like "Read more" links in cases like this, which potentially contain unfamiliar terms.

It could look like this.

You can't invoke `locations()`, because it has the type `string[]` which has no compatible call signature.

Did you mean to just use `locations` like this? 

  3 | // other code for context...
  4 | this.signUpService.locations;
  5 | // other code for context

Visit https://www.typescriptlang.org/e/missing-call-signature for more details about this error.

And a page like https://www.typescriptlang.org/e/missing-call-signature could list some examples which throw this error and explain terms like _"invoke"_ , _"call signature"_ and so on.

But just some ideas ๐Ÿ‘‹๐Ÿ˜Š

All 7 comments

Man I like the passion to immediately convert some feedback on Twitter into a GitHub issue. What I really like in cases like this is _"Did you mean...?"_ types of error feedback (showing the same surrounding code from the user, but modified). I personally also like "Read more" links in cases like this, which potentially contain unfamiliar terms.

It could look like this.

You can't invoke `locations()`, because it has the type `string[]` which has no compatible call signature.

Did you mean to just use `locations` like this? 

  3 | // other code for context...
  4 | this.signUpService.locations;
  5 | // other code for context

Visit https://www.typescriptlang.org/e/missing-call-signature for more details about this error.

And a page like https://www.typescriptlang.org/e/missing-call-signature could list some examples which throw this error and explain terms like _"invoke"_ , _"call signature"_ and so on.

But just some ideas ๐Ÿ‘‹๐Ÿ˜Š

I would like to start having a look into this one. It is my contribution so may need some assistance navigating ๐Ÿ˜„

Hi @DanielRosenwasser, I've submitted a PR to improve this (#37800) โ€” is there any procedure I should follow to get it reviewed?

Thanks @jtbandes!

During the beta period the TypeScript team end up particularly busy with bugs, as your PR is a feature we're likely to come around to it post 3.9 launch (unless someone can quickly get through the PR) - so for now, this is great and it's on us to do the next step ๐Ÿ‘

Thanks!

Small nit: the issue isn't exactly considered a feature, but @orta's right - most of the team is heads down trying to get work done in time for 3.9. I did leave some feedback on the PR.

Thanks @jtbandes!

Was this page helpful?
0 / 5 - 0 ratings