# Multiple scenes problem in setup

**URL:** <https://phaser.discourse.group/t/multiple-scenes-problem-in-setup/2424>\
**Category:** Phaser 3\
**Created:** [May 12, 2019, 2:17pm UTC](https://phaser.discourse.group/t/multiple-scenes-problem-in-setup/2424 "2019-05-12T14:17:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elchicodepython](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/elchicodepython/32/1401_2.png) [@elchicodepython](https://phaser.discourse.group/u/elchicodepython)\
**Post date:** [May 12, 2019, 2:17pm UTC](https://phaser.discourse.group/t/multiple-scenes-problem-in-setup/2424/1 "2019-05-12T14:17:51Z")

</div>

Hi there,

im using Phaser with Typescript and in only allows me to select one scene. (Without using an array in scene parameter)

If I use an array of Scenes in the scene parameter, it gives me the following error:

```
 TS2345: Argument of type '{ type: number; width: number; height: number; physics: { default: string; arcade: { gravity: { y: number; }; }; }; scene: (typeof GameScene)[]; }' is not assignable to parameter of type 'GameConfig'.
  Types of property 'scene' are incompatible.
    Type '(typeof GameScene)[]' is not assignable to type 'Function | Scene | SettingsConfig | Scene[] | SettingsConfig[] | CreateSceneFromObjectConfig | CreateSceneFromObjectConfig[] | undefined'.
      Type '(typeof GameScene)[]' is not assignable to type 'Scene[]'.
        Type 'typeof GameScene' is missing the following properties from type 'Scene': sys, game, anims, cache, and 22 more.

```

I have the following setup when having the error:

```
import Phaser from "phaser";
import guitar_sound from "../common_assets/sounds/395217 __ueffects__ guitar-tune-3-sailsmen.wav";

class GameScene extends Phaser.Scene {
  constructor() {
super("FirstScene");
  }

  init() {}

  preload(): void {
this.load.audio("guitar_sound", guitar_sound);
  }

  create(): void {
this.add.text(20, 20, "Loading game...");
// TODO
  }
  update(time: number, delta: number): void {
// TODO
  }
}

var config = {
  type: Phaser.AUTO,
  width: 800,
  height: 600,
  physics: {
    default: "arcade",
    arcade: {
      gravity: { y: 300 }
    }
  },
  scene: [GameScene]
};

export class StarfallGame extends Phaser.Game {
  constructor(config: Phaser.Types.Core.GameConfig) {
    super(config);
  }
}

window.onload = () => {
  var game = new StarfallGame(config);
};

```

Don’t know if I am doing something wrong but I look already a lot of tutorials and it seems im doing good…

Thanks in advance for the help 🙂

---

<div class="post-metadata">

**Author:** ![cheesepencil](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/cheesepencil/32/1420_2.png) [@cheesepencil](https://phaser.discourse.group/u/cheesepencil)\
**Post date:** [May 16, 2019, 1:54am UTC](https://phaser.discourse.group/t/multiple-scenes-problem-in-setup/2424/3 "2019-05-16T01:54:42Z")

</div>

I’m also having this problem, and I didn’t have this in the previous version. Maybe some of the types were broken in the last update (which was just a couple days ago).

What version of phaser are you using?

---

<div class="post-metadata">

**Author:** ![cheesepencil](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/cheesepencil/32/1420_2.png) [@cheesepencil](https://phaser.discourse.group/u/cheesepencil)\
**Post date:** [May 16, 2019, 3:02am UTC](https://phaser.discourse.group/t/multiple-scenes-problem-in-setup/2424/4 "2019-05-16T03:02:36Z")

</div>

try this:

```
var config = {
  type: Phaser.AUTO,
  width: 800,
  height: 600,
  physics: {
    default: "arcade",
    arcade: {
      gravity: { y: 300 }
    }
  },
  scene: [new GameScene()] // <-- using actual instance of GameScene instead of its type definition, I think?
};

```

The type definitions were just updated in the new release a week or two ago and now the `scene` property on `GameConfig` is no longer just `object`, it is now `Phaser.Scene | Array<Phaser.Scene> | Phaser.Types.Scenes.SettingsConfig | Phaser.Types.Scenes.SettingsConfig[] | Phaser.Types.Scenes.CreateSceneFromObjectConfig | Phaser.Types.Scenes.CreateSceneFromObjectConfig[] | Function` and don’t ask me why but that’s probably why we have to use an instance of the scene class instead of the class definition.

Someone who understands TS better than I do can hopefully enlighten us!

---

<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:** [May 16, 2019, 6:23am UTC](https://phaser.discourse.group/t/multiple-scenes-problem-in-setup/2424/5 "2019-05-16T06:23:34Z")

</div>

> <https://github.com/photonstorm/phaser/issues/4522>
