Updates TS Parser to handle Function[]

Fix #4522
This commit is contained in:
Richard Davey 2019-06-04 18:14:58 +01:00
parent 558f6aea55
commit d82b46c4d2
4 changed files with 7 additions and 4 deletions

View file

@ -400,7 +400,7 @@ class Parser {
if (name.indexOf('*') != -1) {
name = name.split('*').join('any');
}
if (name.indexOf('.<') != -1) {
if (name.indexOf('.<') != -1 && name !== 'Array.<function()>') {
name = name.split('.<').join('<');
}
return name;
@ -410,6 +410,8 @@ class Parser {
return 'number';
if (name === 'function')
return 'Function';
if (name === 'Array.<function()>')
return 'Function[]';
if (name === 'array')
return 'any[]';
if (name.startsWith('Array<')) {

File diff suppressed because one or more lines are too long

View file

@ -490,7 +490,7 @@ export class Parser {
if (name.indexOf('*') != -1) {
name = (<string>name).split('*').join('any');
}
if (name.indexOf('.<') != -1) {
if (name.indexOf('.<') != -1 && name !== 'Array.<function()>') {
name = (<string>name).split('.<').join('<');
}
return name;
@ -499,6 +499,7 @@ export class Parser {
private processTypeName(name: string): string {
if (name === 'float') return 'number';
if (name === 'function') return 'Function';
if (name === 'Array.<function()>') return 'Function[]';
if (name === 'array') return 'any[]';
if (name.startsWith('Array<')) {

View file

@ -11,7 +11,7 @@
* @property {HTMLCanvasElement} [canvas=null] - Provide your own Canvas element for Phaser to use instead of creating one.
* @property {string} [canvasStyle=null] - CSS styles to apply to the game canvas instead of Phasers default styles.
* @property {CanvasRenderingContext2D} [context] - Provide your own Canvas Context for Phaser to use, instead of creating one.
* @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`.
* @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`.
* @property {string[]} [seed] - Seed for the random number generator.
* @property {string} [title=''] - The title of the game. Shown in the browser console.
* @property {string} [url='http://phaser.io'] - The URL of the game. Shown in the browser console.