Skip to content

Commit 7c46cff

Browse files
authored
Merge pull request phaserjs#3444 from orblazer/fix-types
Fix wrong types
2 parents 32d9b82 + ed1f2a7 commit 7c46cff

9 files changed

Lines changed: 63 additions & 50 deletions

File tree

src/cameras/2d/CameraManager.js

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@ var GetFastValue = require('../../utils/object/GetFastValue');
1010
var PluginManager = require('../../boot/PluginManager');
1111
var RectangleContains = require('../../geom/rectangle/Contains');
1212

13+
/**
14+
* @typedef {object} InputJSONCameraObject
15+
*
16+
* @property {string} [name=''] - [description]
17+
* @property {integer} [x=0] - [description]
18+
* @property {integer} [y=0] - [description]
19+
* @property {integer} [width] - [description]
20+
* @property {integer} [height] - [description]
21+
* @property {float} [zoom=1] - [description]
22+
* @property {float} [rotation=0] - [description]
23+
* @property {boolean} [roundPixels=false] - [description]
24+
* @property {float} [scrollX=0] - [description]
25+
* @property {float} [scrollY=0] - [description]
26+
* @property {(false|string)} [backgroundColor=false] - [description]
27+
* @property {?object} [bounds] - [description]
28+
* @property {number} [bounds.x=0] - [description]
29+
* @property {number} [bounds.y=0] - [description]
30+
* @property {number} [bounds.width] - [description]
31+
* @property {number} [bounds.height] - [description]
32+
*/
33+
1334
/**
1435
* @classdesc
1536
* [description]
@@ -204,39 +225,13 @@ var CameraManager = new Class({
204225
return null;
205226
},
206227

207-
/*
208-
{
209-
cameras: [
210-
{
211-
name: string
212-
x: int
213-
y: int
214-
width: int
215-
height: int
216-
zoom: float
217-
rotation: float
218-
roundPixels: bool
219-
scrollX: float
220-
scrollY: float
221-
backgroundColor: string
222-
bounds: {
223-
x: int
224-
y: int
225-
width: int
226-
height: int
227-
}
228-
}
229-
]
230-
}
231-
*/
232-
233228
/**
234229
* [description]
235230
*
236231
* @method Phaser.Cameras.Scene2D.CameraManager#fromJSON
237232
* @since 3.0.0
238233
*
239-
* @param {(object|object[])} config - [description]
234+
* @param {(InputJSONCameraObject|InputJSONCameraObject[])} config - [description]
240235
*
241236
* @return {Phaser.Cameras.Scene2D.CameraManager} [description]
242237
*/

src/display/color/Color.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ var Color = new Class({
8181
* An array containing the calculated color values for WebGL use.
8282
*
8383
* @name Phaser.Display.Color#gl
84-
* @type {[number,number,number,number]}
84+
* @type {number[]}
8585
* @since 3.0.0
8686
*/
8787
this.gl = [ 0, 0, 0, 1 ];

src/loader/LoaderPlugin.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,28 @@ var ParseXMLBitmapFont = require('../gameobjects/bitmaptext/ParseXMLBitmapFont')
1414
var PluginManager = require('../boot/PluginManager');
1515
var XHRSettings = require('./XHRSettings');
1616

17+
/**
18+
* @typedef {object} LoaderFileObject
19+
*
20+
* @property {string} key - [description]
21+
* @property {string} type - [description]
22+
* @property {string} [url] - [description]
23+
* @property {string[]} [urls] - [description]
24+
* @property {string} [textureURL] - [description]
25+
* @property {string} [atlasURL] - [description]
26+
* @property {string} [xmlURL] - [description]
27+
* @property {string[]} [textureURLs] - [description]
28+
* @property {string[]} [atlasURLs] - [description]
29+
* @property {object} [config] - [description]
30+
* @property {object} [json] - [description]
31+
* @property {XHRSettingsObject} [xhrSettings] - [description]
32+
* @property {XHRSettingsObject} [textureXhrSettings] - [description]
33+
* @property {XHRSettingsObject} [atlasXhrSettings] - [description]
34+
* @property {XHRSettingsObject} [xmlXhrSettings] - [description]
35+
* @property {XHRSettingsObject} [audioXhrSettings] - [description]
36+
* @property {XHRSettingsObject} [jsonXhrSettings] - [description]
37+
*/
38+
1739
/**
1840
* @classdesc
1941
* [description]
@@ -882,7 +904,7 @@ var LoaderPlugin = new Class({
882904
* @method Phaser.Loader.LoaderPlugin#loadArray
883905
* @since 3.0.0
884906
*
885-
* @param {array} files - [description]
907+
* @param {LoaderFileObject[]} files - [description]
886908
*
887909
* @return {boolean} [description]
888910
*/
@@ -905,7 +927,7 @@ var LoaderPlugin = new Class({
905927
* @method Phaser.Loader.LoaderPlugin#file
906928
* @since 3.0.0
907929
*
908-
* @param {object} file - [description]
930+
* @param {LoaderFileObject} file - [description]
909931
*
910932
* @return {Phaser.Loader.File} [description]
911933
*/

src/math/random-data-generator/RandomDataGenerator.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var Class = require('../../utils/Class');
1515
* @constructor
1616
* @since 3.0.0
1717
*
18-
* @param {array} [seeds] - [description]
18+
* @param {string[]} [seeds] - [description]
1919
*/
2020
var RandomDataGenerator = new Class({
2121

@@ -82,7 +82,7 @@ var RandomDataGenerator = new Class({
8282
* [description]
8383
*
8484
* @name Phaser.Math.RandomDataGenerator#sign
85-
* @type {array}
85+
* @type {number[]}
8686
* @since 3.0.0
8787
*/
8888
this.signs = [ -1, 1 ];
@@ -155,7 +155,7 @@ var RandomDataGenerator = new Class({
155155
* @method Phaser.Math.RandomDataGenerator#init
156156
* @since 3.0.0
157157
*
158-
* @param {(string|array)} seeds - [description]
158+
* @param {(string|string[])} seeds - [description]
159159
*/
160160
init: function (seeds)
161161
{
@@ -177,7 +177,7 @@ var RandomDataGenerator = new Class({
177177
* @method Phaser.Math.RandomDataGenerator#sow
178178
* @since 3.0.0
179179
*
180-
* @param {*[]} seeds - The array of seeds: the `toString()` of each value is used.
180+
* @param {string[]} seeds - The array of seeds: the `toString()` of each value is used.
181181
*/
182182
sow: function (seeds)
183183
{

src/physics/arcade/World.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ var World = new Class({
402402
* @method Phaser.Physics.Arcade.World#remove
403403
* @since 3.0.0
404404
*
405-
* @param {Phaser.GameObjects.GameObject} object - [description]
405+
* @param {Phaser.Physics.Arcade.Body} object - [description]
406406
*/
407407
remove: function (object)
408408
{
@@ -1789,7 +1789,7 @@ var World = new Class({
17891789
* @method Phaser.Physics.Arcade.World#wrapArray
17901790
* @since 3.3.0
17911791
*
1792-
* @param {*[]} arr
1792+
* @param {Array.<*>} arr
17931793
* @param {number} [padding=0] - An amount added to the boundary.
17941794
*/
17951795
wrapArray: function (arr, padding)

src/scene/Scene.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
var Class = require('../utils/Class');
88
var Systems = require('./Systems');
99

10-
/**
11-
* @typedef {object} SceneConfig
12-
*
13-
* @property
14-
*/
15-
1610
/**
1711
* @classdesc
1812
* [description]

src/scene/Settings.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@ var CONST = require('./const');
88
var GetValue = require('../utils/object/GetValue');
99
var InjectionMap = require('./InjectionMap');
1010

11+
// TODO 22/03/2018 Fix "plugins" type
12+
1113
/**
1214
* @typedef {object} SettingsConfig
1315
*
1416
* @property {string} [key] - [description]
1517
* @property {boolean} [active=false] - [description]
1618
* @property {boolean} [visible=true] - [description]
17-
* @property {(false|[type])} [files=false] - [description]
18-
* @property {?[type]} [cameras=null] - [description]
19+
* @property {(false|LoaderFileObject[])} [files=false] - [description]
20+
* @property {?(InputJSONCameraObject|InputJSONCameraObject[])} [cameras=null] - [description]
1921
* @property {Object.<string, string>} [map] - [description]
2022
* @property {object} [physics={}] - [description]
2123
* @property {object} [loader={}] - [description]
22-
* @property {(false|[type])} [plugins=false] - [description]
24+
* @property {(false|*)} [plugins=false] - [description]
2325
*/
2426

2527
/**
@@ -31,12 +33,12 @@ var InjectionMap = require('./InjectionMap');
3133
* @property {boolean} visible - [description]
3234
* @property {boolean} isBooted - [description]
3335
* @property {object} data - [description]
34-
* @property {(false|[type])} files - [description]
35-
* @property {?[type]} cameras - [description]
36+
* @property {(false|LoaderFileObject[])} files - [description]
37+
* @property {?(InputJSONCameraObject|InputJSONCameraObject[])} cameras - [description]
3638
* @property {Object.<string, string>} map - [description]
3739
* @property {object} physics - [description]
3840
* @property {object} loader - [description]
39-
* @property {(false|[type])} plugins - [description]
41+
* @property {(false|*)} plugins - [description]
4042
*/
4143

4244
var Settings = {

src/time/Clock.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ var Clock = new Class({
157157
*
158158
* @param {number} delay - [description]
159159
* @param {function} callback - [description]
160-
* @param {*[]} args - [description]
160+
* @param {Array.<*>} args - [description]
161161
* @param {*} callbackScope - [description]
162162
*
163163
* @return {Phaser.Time.TimerEvent} [description]

src/time/TimerEvent.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var GetFastValue = require('../utils/object/GetFastValue');
1515
* @property {boolean} [loop=false] - [description]
1616
* @property {function} [callback] - [description]
1717
* @property {*} [callbackScope] - [description]
18-
* @property {*[]} [args] - [description]
18+
* @property {Array.<*>} [args] - [description]
1919
* @property {number} [timeScale=1] - [description]
2020
* @property {number} [startAt=1] - [description]
2121
* @property {boolean} [paused=false] - [description]

0 commit comments

Comments
 (0)