Jump to content

Weird typing issues..


StarToaster
 Share

Recommended Posts

Hi,

I'm getting some really odd issues when I am trying to extend Babylon JS objects. 

Example:


class Scene extends BABYLON.Scene {
}

class Game
{
    public engine: BABYLON.Engine;
    public currentScene: Scene = null;
}

Mesh = BABYLON.Mesh.CreateGround("newGround", 1000, 1000, 1, newGame.currentScene);

Gives me the following errors:

    (9,69): error TS2345: Argument of type 'Scene' is not assignable to parameter of type 'BABYLON.Scene'.
      Property '_environmentTexture' is protected but type 'Scene' is not a class derived from 'Scene'.

Is this something that is not supported? Weird thing is I had this working and then suddenly it stopped.. 

Thanks!

-StarToaster

Link to comment
Share on other sites

23 minutes ago, Deltakosh said:

This seems like a problem with versions of d.ts

Can you try with the very latest version?

I am running on 3.0.4-beta. I tried removing the node_modules folder and reinstalling everything, but I still get the same issue.

The weird thing is if I create a new instance of BABYLON.Scene it works fine, but if I try to extend the Scene object it throws 

Argument of type 'Scene' is not assignable to parameter of type 'BABYLON.Scene'.
      Property '_environmentTexture' is protected but type 'Scene' is not a class derived from 'Scene'.
Link to comment
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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