From 13d4dfd9e33ae3f2ef140d49e9fb74859a349b26 Mon Sep 17 00:00:00 2001 From: Clark Stevenson Date: Tue, 6 Oct 2015 15:34:26 +0100 Subject: [PATCH] TypeScript Definitions. PluginManager.add is now generic. Whatever class you pass in will come back out as an instance. Example `var myAStar = this.game.plugins.add(Phaser.Plugin.AStar);` --- typescript/phaser.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/typescript/phaser.d.ts b/typescript/phaser.d.ts index a5cb87f05..a0f46fff4 100644 --- a/typescript/phaser.d.ts +++ b/typescript/phaser.d.ts @@ -3575,6 +3575,10 @@ declare module Phaser { } } + interface PluginConstructorOf { + new (...parameters: any[]): T; + } + class PluginManager implements IStateCycle { constructor(game: Phaser.Game); @@ -3582,7 +3586,7 @@ declare module Phaser { game: Phaser.Game; plugins: Phaser.Plugin[]; - add(plugin: Phaser.Plugin | typeof Phaser.Plugin, ...parameter: any[]): Phaser.Plugin; + add(plugin: PluginConstructorOf, ...parameters: any[]): T; destroy(): void; postRender(): void; postUpdate(): void;