Jump to content
Search Community

Using GSAP with JetBrains' PHPStorm/WebStorm — "unresolved type" warnings in JS checking

cerulean test
Moderator Tag

Go to solution Solved by Carl,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I'm using PHPStorm* (http://www.jetbrains.com/phpstorm/) for a project at work and I'm using GSAP in a javascript file that's part of the project.  Having difficulties getting it to recognize the GSAP libraries — and others, to be sure, such as enquire.js.  Specifically I keep getting getting warnings such as

unresolved type TimelineMax
unresolved type TweenMax

I've gone through PHPStorm's process for adding external libraries to the project (http://www.jetbrains.com/phpstorm/webhelp/configuring-javascript-libraries.html), but no dice.


Has anyone used GSAP with JetBrain's products — WebStorm, PHPStorm — and had any success at besting this?


*Which is essentially WebStorm+PHP

Link to comment
Share on other sites

  • 2 years later...

Now with the new TypeScript definitions ( "GSAP" instead of "greensock") we have a problem with pure Javascript:


The definitions are all for the namespace gsap, like if you type gsap.TweenMax.to(...); syntax highlighting and type checking works.

I had to go to the DefinitelyTyped github page to finally find out that all GSAP types are inside a "gsap" namespace.


But the code doesn't work with this namespace, because in the Javascript CDN, it is not defined.


How can I get around this? I have PHPStorm for some weeks, so I don't know the super-secret settings yet that could make this work!

Anyone having success using GSAP type checking in a current version of (PHP|Web)Storm?!


I could imagine like a directive to tell the editor "pretend that all inside the gsap definition is global"

Link to comment
Share on other sites

Thank you Blake :) until then I ignore the warnings.


Also working with the PIXIJS definitions looks quirky. The definitions look fine but I wonder if PhpStorm can handle multiple inheritances, at least with pure Javascript.

It always tells me that "X is not assignable to parameter of type Y", but X actually inherited from Y and should be allowed there ... and a lot more ...
But I'm still learning PHPStorm and having one eureka moment after the other. But that's an entirely different story :)


I've been working with sublime text and flashDevelop for AS3 for a long time.

Now PHP/WebStorm is quite an epiphany for me ;)

  • Like 1
Link to comment
Share on other sites

I never could understand the popularity of sublime text... *cough*  @kreativzirkel


Not sure about the Pixi problem. Is the error with something that you are extending, or something that pixi does? My license is expired so I can't test right now, but I use another JetBrains product, ReSharper, and will see if it has the same problem. It's usually pretty good at being able to infer types in JavaScript.


But the best way to get the most out of the editor is to just use TypeScript. You're smart, and you know ActionScript, so it should take you no time at all to get up to speed. It really is a game changer if you work on large or complicated projects.


If you want to try it out, you'll have to add the definitions to your project. The external library definitions are just for JavaScript. And I would still use those old GSAP definitions I linked to. You can search for other types here


  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...