Skip to content

Update pick/weightedPick typings to accept array-like objects#7258

Open
Bertie690 wants to merge 1 commit intophaserjs:masterfrom
Bertie690:pick-types
Open

Update pick/weightedPick typings to accept array-like objects#7258
Bertie690 wants to merge 1 commit intophaserjs:masterfrom
Bertie690:pick-types

Conversation

@Bertie690
Copy link

@Bertie690 Bertie690 commented Feb 27, 2026

Fixes #7257

This PR:

  • Fixes a bug

Describe the changes below:

Updated typigs of relevant methods to allow passing in array-like objects like TypedArray and readonly arrays.


Note

Low Risk
Low risk: this is a JSDoc/typing-only update (no runtime logic changes) that broadens accepted parameter types for pick/weightedPick and refines the sign return type annotation.

Overview
Updates Phaser.Math.RandomDataGenerator JSDoc generics so pick and weightedPick accept ArrayLike<T> (e.g., typed arrays / readonly arrays) instead of only T[].

Refines the sign JSDoc return type from number to the literal union -1 | 1 for more accurate typings.

Written by Cursor Bugbot for commit ab3f40f. This will update automatically on new commits. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phaser.Math.RND.Pick and Phaser.Math.RND.WeightedPick should use ArrayLike interface

1 participant