Skip to content

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

@michal-bures

Description

@michal-bures

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions