Jump to content

[SOLVED] Getting useful type hinting (Webstorm or PHPStorm)

Recommended Posts


I use PHPStorm or Webstorm for most projects I do (mostly PHP). I want to try BabylonJS in combination with that software.
I follow the tutorial, put an index.html and babylon.2.5.js in the same folder, reference it in a script tag, working like a charm.
PHPstorm hints to classes and functions, very cool. But when I want to fill in parameters, I see this:


It's something, but not very much. I suspect this is because the babylon.2.5.js file is transpiled from TypeScript.

I figured I want to work in TypeScript because that language is nicer imho than Javascript. So again, followed the tutorial. added the d.ts file to my PHPstorm project.
That doesn't work at all because PHPStorm cannot find any reference to the BABYLON namespace.

So I tried something else, added babylonjs as an external library (apperently someone made that for PHPStorm) but the effect is the same.

Is anybody working here with PHPStorm (or webstorm) + TS + BabylonJS and willing to get me started?



Link to post
Share on other sites

Thanks TomaszFurca. Simple yet amazing answer. This works like a charm!

One small totally unrelated question. When I copy the code from doc.babylonjs.com I get this error:

HTMLElement' is not assignable to type 'HTMLCanvasElement'. Property 'height' is missing in type 'HTMLElement.

On this line:

this._canvas = document.getElementById(canvasElement);


Thanks for helping!

Link to post
Share on other sites

Awsome, that worked indeed.

Now is the time for me to dive in Typescript. Thanks for pointing me in the right direction guys. Very fast and friendly community!

To whoever is making the docs: It could be a good idea to check the beginners tutorial, there is this typecasting error + the wrong version of BJS in the html script tag (2.3 instead of 2.5)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...