Skip to content

Commit d82b46c

Browse files
committed
Updates TS Parser to handle Function[]
Fix phaserjs#4522
1 parent 558f6ae commit d82b46c

4 files changed

Lines changed: 7 additions & 4 deletions

File tree

scripts/tsgen/bin/Parser.js

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/tsgen/bin/Parser.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/tsgen/src/Parser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ export class Parser {
490490
if (name.indexOf('*') != -1) {
491491
name = (<string>name).split('*').join('any');
492492
}
493-
if (name.indexOf('.<') != -1) {
493+
if (name.indexOf('.<') != -1 && name !== 'Array.<function()>') {
494494
name = (<string>name).split('.<').join('<');
495495
}
496496
return name;
@@ -499,6 +499,7 @@ export class Parser {
499499
private processTypeName(name: string): string {
500500
if (name === 'float') return 'number';
501501
if (name === 'function') return 'Function';
502+
if (name === 'Array.<function()>') return 'Function[]';
502503
if (name === 'array') return 'any[]';
503504

504505
if (name.startsWith('Array<')) {

src/core/typedefs/GameConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one.
1212
* @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phasers default styles.
1313
* @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one.
14-
* @property {(Phaser.Scene|Phaser.Scene[]|Phaser.Types.Scenes.SettingsConfig|Phaser.Types.Scenes.SettingsConfig[]|Phaser.Types.Scenes.CreateSceneFromObjectConfig|Phaser.Types.Scenes.CreateSceneFromObjectConfig[]|function)} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have `{ active: true }`. See the `sceneConfig` argument in `Phaser.Scenes.SceneManager#add`.
14+
* @property {(Phaser.Scene|Phaser.Scene[]|Phaser.Types.Scenes.SettingsConfig|Phaser.Types.Scenes.SettingsConfig[]|Phaser.Types.Scenes.CreateSceneFromObjectConfig|Phaser.Types.Scenes.CreateSceneFromObjectConfig[]|function|function[])} [scene=null] - A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have `{ active: true }`. See the `sceneConfig` argument in `Phaser.Scenes.SceneManager#add`.
1515
* @property {string[]} [seed] - Seed for the random number generator.
1616
* @property {string} [title=''] - The title of the game. Shown in the browser console.
1717
* @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console.

0 commit comments

Comments
 (0)