Skip to content

Commit 49a27bd

Browse files
authored
Merge pull request phaserjs#4514 from BeLi4L/master
TypeScript: Improve `Phaser.Utils.Array.Matrix` types
2 parents ad09a18 + f33a9d7 commit 49a27bd

9 files changed

Lines changed: 44 additions & 17 deletions

File tree

src/utils/array/matrix/CheckMatrix.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@
2222
*
2323
* @function Phaser.Utils.Array.Matrix.CheckMatrix
2424
* @since 3.0.0
25+
*
26+
* @generic T
27+
* @genericUse {T[][]} - [matrix]
2528
*
26-
* @param {array} matrix - The array to check.
29+
* @param {T[][]} [matrix] - The array to check.
2730
*
2831
* @return {boolean} `true` if the given `matrix` array is a valid matrix.
2932
*/

src/utils/array/matrix/MatrixToString.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ var CheckMatrix = require('./CheckMatrix');
1313
* @function Phaser.Utils.Array.Matrix.MatrixToString
1414
* @since 3.0.0
1515
*
16-
* @param {array} matrix - A 2-dimensional array.
16+
* @generic T
17+
* @genericUse {T[][]} - [matrix]
18+
*
19+
* @param {T[][]} [matrix] - A 2-dimensional array.
1720
*
1821
* @return {string} A string representing the matrix.
1922
*/

src/utils/array/matrix/ReverseColumns.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
* @function Phaser.Utils.Array.Matrix.ReverseColumns
1111
* @since 3.0.0
1212
*
13-
* @param {array} matrix - The array matrix to reverse the columns for.
13+
* @generic T
14+
* @genericUse {T[][]} - [matrix,$return]
1415
*
15-
* @return {array} The column reversed matrix.
16+
* @param {T[][]} [matrix] - The array matrix to reverse the columns for.
17+
*
18+
* @return {T[][]} The column reversed matrix.
1619
*/
1720
var ReverseColumns = function (matrix)
1821
{

src/utils/array/matrix/ReverseRows.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@
1010
* @function Phaser.Utils.Array.Matrix.ReverseRows
1111
* @since 3.0.0
1212
*
13-
* @param {array} matrix - The array matrix to reverse the rows for.
13+
* @generic T
14+
* @genericUse {T[][]} - [matrix,$return]
1415
*
15-
* @return {array} The column reversed matrix.
16+
* @param {T[][]} [matrix] - The array matrix to reverse the rows for.
17+
*
18+
* @return {T[][]} The column reversed matrix.
1619
*/
1720
var ReverseRows = function (matrix)
1821
{

src/utils/array/matrix/Rotate180.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ var RotateMatrix = require('./RotateMatrix');
1212
* @function Phaser.Utils.Array.Matrix.Rotate180
1313
* @since 3.0.0
1414
*
15-
* @param {array} matrix - The array to rotate.
15+
* @generic T
16+
* @genericUse {T[][]} - [matrix,$return]
1617
*
17-
* @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix.
18+
* @param {T[][]} [matrix] - The array to rotate.
19+
*
20+
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
1821
*/
1922
var Rotate180 = function (matrix)
2023
{

src/utils/array/matrix/RotateLeft.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ var RotateMatrix = require('./RotateMatrix');
1212
* @function Phaser.Utils.Array.Matrix.RotateLeft
1313
* @since 3.0.0
1414
*
15-
* @param {array} matrix - The array to rotate.
15+
* @generic T
16+
* @genericUse {T[][]} - [matrix,$return]
1617
*
17-
* @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix.
18+
* @param {T[][]} [matrix] - The array to rotate.
19+
*
20+
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
1821
*/
1922
var RotateLeft = function (matrix)
2023
{

src/utils/array/matrix/RotateMatrix.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ var TransposeMatrix = require('./TransposeMatrix');
1818
* @function Phaser.Utils.Array.Matrix.RotateMatrix
1919
* @since 3.0.0
2020
*
21-
* @param {array} matrix - The array to rotate.
21+
* @generic T
22+
* @genericUse {T[][]} - [matrix,$return]
23+
*
24+
* @param {T[][]} [matrix] - The array to rotate.
2225
* @param {(number|string)} [direction=90] - The amount to rotate the matrix by.
2326
*
24-
* @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix.
27+
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
2528
*/
2629
var RotateMatrix = function (matrix, direction)
2730
{

src/utils/array/matrix/RotateRight.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ var RotateMatrix = require('./RotateMatrix');
1212
* @function Phaser.Utils.Array.Matrix.RotateRight
1313
* @since 3.0.0
1414
*
15-
* @param {array} matrix - The array to rotate.
15+
* @generic T
16+
* @genericUse {T[][]} - [matrix,$return]
1617
*
17-
* @return {array} The rotated matrix array. The source matrix should be discard for the returned matrix.
18+
* @param {T[][]} [matrix] - The array to rotate.
19+
*
20+
* @return {T[][]} The rotated matrix array. The source matrix should be discard for the returned matrix.
1821
*/
1922
var RotateRight = function (matrix)
2023
{

src/utils/array/matrix/TransposeMatrix.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
*
1212
* @function Phaser.Utils.Array.Matrix.TransposeMatrix
1313
* @since 3.0.0
14+
*
15+
* @generic T
16+
* @genericUse {T[][]} - [array,$return]
17+
*
18+
* @param {T[][]} [array] - The array matrix to transpose.
1419
*
15-
* @param {array} array - The array matrix to transpose.
16-
*
17-
* @return {array} A new array matrix which is a transposed version of the given array.
20+
* @return {T[][]} A new array matrix which is a transposed version of the given array.
1821
*/
1922
var TransposeMatrix = function (array)
2023
{

0 commit comments

Comments
 (0)