Typescript : Property 'volume' does not exist on type 'BaseSound'

Hi all!

Trying to do something where I change the volume of an audio instance after it has been created, and Phaser 3 notes says to just use the setVolume and volume properties on the BaseSound class. However, these are not properties in the documentation and are flagging Typescript errors. With an @ts-ignore, this code works.

// class property
backgroundMusicTrack : Phaser.Sound.BaseSound 
// in create
create(){
    this.backgroundMusicTrack = this.add.sound('key', config);

    this.input.on('pointerdown', () => {
            this.backgroundMusicTrack.setVolume(this.backgroundMusicTrack.volume-.1);
        })
}

Questions :

  1. Am I using the BaseSound class incorrectly?
  2. Is there a different class to use to type backgroundMusicTrack other than BaseSound?

Thanks all :slight_smile:

backgroundMusicTrack: Phaser.Sound.HTML5AudioSound |
                      Phaser.Sound.WebAudioSound   |
                      Phaser.Sound.NoAudioSound

But it’s possible volume is missing from NoAudioSound (a mistake); if so, remove it.

Thanks! Was only using BaseSound :slight_smile: