Skip to content

AnimationManager.get should include undefined in its return type #7324

Description

@Bertie690

Version

  • Phaser Version: 4.2.1
  • Operating system: N/A
  • Browser:N/A

Description

Phaser.Animations.AnimationManager#get currently does not include undefined in its return type.

This is unsafe and potentially game-crashing - querying a nonexistent animation will return undefined from the underlying map and possibly crash the game if accessed.

Example Test Code

// silently crashes if key is missing
globalScene.anims.get(key).frameRate = frameRate;

Additional Information

If needed, we could make the updated typing opt-in via declaration merging if or when an alternate type declaration library is found (one which supports conditional types).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions