Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'scene.add.existing' TS definition does not allow adding a Layer #5642

Closed
michal-bures opened this issue Apr 5, 2021 · 2 comments
Closed

Comments

@michal-bures
Copy link
Contributor

michal-bures commented Apr 5, 2021

Version

  • Phaser Version: 3.54

Description

This code produces a typescript compiler error:

export class MyScene extends Scene {
    create() {
        const myLayer = new Phaser.GameObjects.Layer()
        this.add.existing(myLayer)
    }
}

The error:

Argument of type 'Layer' is not assignable to parameter of type 'GameObject | Group'.

Makes sense, as Layer is not a GameObject, so I guess the existing() method on GameObjectFactory should now take GameObject | Group | Layer, right?

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

@michal-bures
Copy link
Contributor Author

Finaly got around to test it on a build from master, it works 👍, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants