3

I am making a Firefox WebExtension. Consequently, I use the relevant API, which, it seems, is not known to WebStorm, hence a lot of warnings.

For example, in the following snippet

        //make the panel a drop zone
        panel.ondragover = function (τ) {
            τ.preventDefault();
            τ.dataTransfer.dropEffect = "move";
        };
        panel.ondrop     = function (τ) {
            τ.preventDefault();
            τ.stopPropagation();
            var skware        = document.getElementById(
                τ.dataTransfer.getData('text'));
            skware.style.top  = (τ.clientY - skware.mouseOffset.y) + 'px';
            skware.style.left = (τ.clientX - skware.mouseOffset.x ) + 'px';
            put('skwarePos',
                skware.id,
                {'top': skware.style.top, 'left': skware.style.left}
            );

things like .dataTransfer would be marked as Unresolved variable.

No big deal, but, surely, there must be a way to tell WebStrom that I'm using Firefox WebExtension JavaScript APIs and that this variable is hence legit.

I found a similar question regarding extensions on Chrome, and did find a library called firefox-Definitely typed, but the squiggly lines remain.

Makyen
  • 31,849
  • 12
  • 86
  • 121
Éric Viala
  • 596
  • 2
  • 12
  • Did you try the suggestions in the question you linked for Chrome? – Makyen Jan 29 '17 at 08:50
  • I declared the "definitelt typed" libraries for Chrome *and* FF and it seems to get better, possibly due to the fact that said extension started as a Chrome one. – Éric Viala Feb 02 '17 at 11:56
  • 1
    I declared the "definitelt typed" libraries for Chrome *and* FF and it seems to get better, possibly due to the fact that said extension started as a Chrome one. Now, this code is definitely *not* typed, I mean, it is not supposed to be TypeScript, and now I have some other ennoying warnings such as *Argument type Function is not assignable to parameter type T* : I suppose I still have some way to go before I use Webstrom to its fullest :-) – Éric Viala Feb 02 '17 at 12:02

1 Answers1

4

What you need to install isn't the firefox type definition but firefox-webext-browser, in the same way outlined in the issue for chrome you mentioned

Fuzzel
  • 155
  • 12