Merge pull request #4892 from BeLi4L/master

TypeScript: Improve `Phaser.Math.RND` types
This commit is contained in:
Richard Davey 2019-12-18 14:36:52 +00:00 committed by GitHub
commit 55212dc2fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 8 deletions

View file

@ -347,10 +347,14 @@ var RandomDataGenerator = new Class({
* *
* @method Phaser.Math.RandomDataGenerator#pick * @method Phaser.Math.RandomDataGenerator#pick
* @since 3.0.0 * @since 3.0.0
*
* @generic T
* @genericUse {T[]} - [array]
* @genericUse {T} - [$return]
* *
* @param {array} array - The array to pick a random element from. * @param {T[]} array - The array to pick a random element from.
* *
* @return {*} A random member of the array. * @return {T} A random member of the array.
*/ */
pick: function (array) pick: function (array)
{ {
@ -376,9 +380,13 @@ var RandomDataGenerator = new Class({
* @method Phaser.Math.RandomDataGenerator#weightedPick * @method Phaser.Math.RandomDataGenerator#weightedPick
* @since 3.0.0 * @since 3.0.0
* *
* @param {array} array - The array to pick a random element from. * @generic T
* @genericUse {T[]} - [array]
* @genericUse {T} - [$return]
* *
* @return {*} A random member of the array. * @param {T[]} array - The array to pick a random element from.
*
* @return {T} A random member of the array.
*/ */
weightedPick: function (array) weightedPick: function (array)
{ {
@ -468,9 +476,12 @@ var RandomDataGenerator = new Class({
* @method Phaser.Math.RandomDataGenerator#shuffle * @method Phaser.Math.RandomDataGenerator#shuffle
* @since 3.7.0 * @since 3.7.0
* *
* @param {array} [array] - The array to be shuffled. * @generic T
* @genericUse {T[]} - [array,$return]
* *
* @return {array} The shuffled array. * @param {T[]} [array] - The array to be shuffled.
*
* @return {T[]} The shuffled array.
*/ */
shuffle: function (array) shuffle: function (array)
{ {

View file

@ -12,9 +12,12 @@
* @function Phaser.Utils.Array.Shuffle * @function Phaser.Utils.Array.Shuffle
* @since 3.0.0 * @since 3.0.0
* *
* @param {array} array - The array to shuffle. This array is modified in place. * @generic T
* @genericUse {T[]} - [array,$return]
* *
* @return {array} The shuffled array. * @param {T[]} array - The array to shuffle. This array is modified in place.
*
* @return {T[]} The shuffled array.
*/ */
var Shuffle = function (array) var Shuffle = function (array)
{ {