Skip to content

Phaser.Math.Pow2.GetPowerOfTwo is declared in phaser.d.ts but undefined at runtime in Phaser 4.1.0 #7309

Closed

Description

@Visualizeit

Version

  • Phaser Version: 4.1.0

  • Operating system: Windows

  • Browser: Chrome

Description

Phaser.Math.Pow2.GetPowerOfTwo is declared in phaser.d.ts, but it is undefined at runtime.

At runtime, Phaser.Math.Pow2 exposes GetNext, IsSize, and IsValue, but not GetPowerOfTwo.

Phaser.Math.Pow2.GetPowerOfTwo // undefined
Phaser.Math.Pow2.GetNext       // function

Expected behavior:

The runtime API and TypeScript declarations should match. Either GetPowerOfTwo should exist at runtime, or phaser.d.ts should declare GetNext instead.

Example Test Code

import Phaser from 'phaser';

console.log('Phaser version:', Phaser.VERSION);

console.log({
    GetPowerOfTwo: Phaser.Math.Pow2.GetPowerOfTwo
});

console.log({
    Pow2: Phaser.Math.Pow2
});

console.log({
    GetNext: Phaser.Math.Pow2.GetNext
});

Runtime result:

Image

TypeScript accepts this because GetPowerOfTwo exists in phaser.d.ts:

Phaser.Math.Pow2.GetPowerOfTwo(9);

But it fails at runtime because GetPowerOfTwo is undefined.

Additional Information

This appears to be a mismatch between the runtime export and the generated TypeScript declarations.

Runtime export appears to be:

module.exports = {
    GetNext: require('./GetPowerOfTwo'),
    IsSize: require('./IsSizePowerOfTwo'),
    IsValue: require('./IsValuePowerOfTwo')
};

But phaser.d.ts declares:

function GetPowerOfTwo(value: number): number;

Activity

  1. added a commit that references this issue on Jun 19, 2026
    66a0fc2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions