WebStorm 2018.3 - Wrong TypeScript function signature ("Invalid number of arguments" false error marker)

I'm having one of those great issues that seemingly cannot be reproduced in a minimal example, but don't seem to go away in the full project.

The problem is as follows:

I'm using `vuex-typescript` in order to work with Vuex in a TypeScript-ish manner. The package provides functions which return typed functions which are then used to access the Vuex store. I have a "vuex action" defined, which takes a single argument as its "payload".

However, when I try to use it in my code, I'm getting an "invalid number of arguments" error marker:

If I didn't know better, this would seem fine, as WebStorm infers that the type is "DispatchAccessorNoPayload", which indeed takes no payload as argument:

However, this is actually not the type of the function - as WebStorm confirms, because when I Ctrl+Click the function, I get transported to the definition, where WebStorm indeed detects the type as "DispatchAccessorWithPayload"!

I have:

  1. Checked I'm not accidentally importing a different function.
  2. Invalidated Cache & Restarted (several times)
  3. Deleted `.idea` folder, started anew.
  4. Tried to produce a minimal example to no avail, as the error simply does not manifest in a bare project - and I can't make it go away by any means in the actual project.

I'm reasonably sure this error only appeared in 2018.3; I used to use WebStorm with `vuex-typescript` for quite a while now. I'm out of troubleshooting ideas. This is quite annoying, as it marks completely valid files as files with errors, so I need to "get used" to seeing red underlines and error markers all over the place - or lose the benefits of arguments and types altogether.

Thanks in advance for any ideas or pointers!

2 comments

No good ideas unfortunately:( we need a way to reproduce the issue to see what's going on.

BTW, 2019.1 EAP has introduced advanced TypeScript support in .vue files (https://blog.jetbrains.com/webstorm/2019/01/webstorm-2019-1-early-access-preview/#better_support_for_vue_projects_with_typescript) - it's now possible to use Typescript language service there to get more accurate error highlighting. You can give it a try

0

Oh! Well, that did fix my issue, great :) Thank you!

1

Please sign in to leave a comment.