-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Description
Version
- Phaser Version: 3.90
- Operating system: Ubuntu 24.04 LTS (irrelevant)
- Browser: N/A
Description
The types of TweenManager.chain, TweenManager.create and TweenManager.addMultiple all include object and/or object[] in the allowed type signature for their config parameters.
This means you can pass ANYTHING shaped like an object to these functions, even ones that almost certainly do not work as expected.
Example Test Code
This code typechecks correctly, despite passing configs that do not align with Phaser's expectations:
// these are technically objects, though unexpected and very much invalid
game.scene.tweens.create([1]);
game.scene.tweens.chain({});Additional Information
From what I can tell, the unions were added in "Extra properties for tween configs" from 2019, which (presumably) was done so you could add extra props to the tween configs without issue.
However, since all of the relevant config types now have [key: string]: any index signatures that allow extra properties anyways, these methods don't need to allow passing object anymore (and makes writing external wrappers for said methods difficult).