Adding phyics to tileSprite with typescript

Hi all,

I’m following the tutorial to create an endless runner but I’m trying to do it in typescript and I’m getting a frustrating error. When running this code:

const platform = this.add
      .tileSprite(posX, 0, platformWidth, 32, "platform")
      .setOrigin(0.5, 0)


    platform.body?.setVelocityX(this.speed * -1);

I get the following typescript error:

Property 'setImmovable' does not exist on type 'Body | StaticBody | BodyType'.
  Property 'setImmovable' does not exist on type 'StaticBody'.

I understand what the error means but I’m hoping someone can tell me how to access those physics related methods in a typesafe way once the tileSprite has been added to the scene.

const platform = this.add
    .tileSprite(0, 0, 32, 32, "platform") as Phaser.GameObjects.TileSprite & { body: Phaser.Physics.Arcade.Body };