# TypeScript error when adding a group to a scene since 3.5.0

**URL:** <https://phaser.discourse.group/t/typescript-error-when-adding-a-group-to-a-scene-since-3-5-0/9166>\
**Category:** Phaser 3\
**Created:** [March 23, 2021, 9:18pm UTC](https://phaser.discourse.group/t/typescript-error-when-adding-a-group-to-a-scene-since-3-5-0/9166 "2021-03-23T21:18:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Calabi](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/calabi/32/3712_2.png) [@Calabi](https://phaser.discourse.group/u/Calabi)\
**Post date:** [March 23, 2021, 9:18pm UTC](https://phaser.discourse.group/t/typescript-error-when-adding-a-group-to-a-scene-since-3-5-0/9166/1 "2021-03-23T21:18:12Z")

</div>

I have updated a project to Phaser 3.53.1 (from Phaser 3.4.something). I have some custom Groups which now return TypeScript errors when adding them to a scene using scene.add.existing(group).

Example code:

```
class GroupNew extends Phaser.GameObjects.Group {
  constructor(scene: Phaser.Scene) {
    super(scene);

    this.scene.add.existing(this); // Returns "Argument of type 'this' is not assignable to parameter of type 'GameObject'."
  }
}

```

I am not sure whether this is a typing problem in the latest version of Phaser or whether I should change my approach when adding custom groups to scenes.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 25, 2021, 1:02am UTC](https://phaser.discourse.group/t/typescript-error-when-adding-a-group-to-a-scene-since-3-5-0/9166/2 "2021-03-25T01:02:25Z")

</div>

Typing problem.

---

<div class="post-metadata">

**Author:** ![Calabi](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/calabi/32/3712_2.png) [@Calabi](https://phaser.discourse.group/u/Calabi)\
**Post date:** [March 25, 2021, 9:40am UTC](https://phaser.discourse.group/t/typescript-error-when-adding-a-group-to-a-scene-since-3-5-0/9166/3 "2021-03-25T09:40:20Z")

</div>

Okay thanks samme. As a temporary work around I am using:

`this.scene.add.existing((this as any) as Phaser.GameObjects.GameObject);`

Hopefully I can switch those back in a later release.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [March 26, 2021, 4:12pm UTC](https://phaser.discourse.group/t/typescript-error-when-adding-a-group-to-a-scene-since-3-5-0/9166/4 "2021-03-26T16:12:54Z")

</div>

Try in Phaser v3.54.0.

---

<div class="post-metadata">

**Author:** ![Calabi](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/calabi/32/3712_2.png) [@Calabi](https://phaser.discourse.group/u/Calabi)\
**Post date:** [March 26, 2021, 6:07pm UTC](https://phaser.discourse.group/t/typescript-error-when-adding-a-group-to-a-scene-since-3-5-0/9166/5 "2021-03-26T18:07:59Z")

</div>

Problem solved. Thanks.
