Version
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:
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;
Version
Phaser Version: 4.1.0
Operating system: Windows
Browser: Chrome
Description
Phaser.Math.Pow2.GetPowerOfTwois declared inphaser.d.ts, but it isundefinedat runtime.At runtime,
Phaser.Math.Pow2exposesGetNext,IsSize, andIsValue, but notGetPowerOfTwo.Expected behavior:
The runtime API and TypeScript declarations should match. Either
GetPowerOfTwoshould exist at runtime, orphaser.d.tsshould declareGetNextinstead.Example Test Code
Runtime result:
TypeScript accepts this because
GetPowerOfTwoexists inphaser.d.ts:But it fails at runtime because
GetPowerOfTwois undefined.Additional Information
This appears to be a mismatch between the runtime export and the generated TypeScript declarations.
Runtime export appears to be:
But
phaser.d.tsdeclares: