Jump to content

Compiler error trying Phaser dev/stabe with Typescript


jnj
 Share

Recommended Posts

Hi,

 

I am following the guide http://www.photonstorm.com/phaser/advanced-phaser-and-typescript-projects.

Have tried with Phaser stable and dev (as of 18 dec).

 

I have created all the files, Preloader etc. and compiling is failing (in Visual Studio) here:

 

Game.ts:

module Castlevania {    export class Game extends Phaser.Game {        constructor() {            super(800, 600, Phaser.AUTO, 'content', null);            this.state.add('Boot', Boot, false);            this.state.add('Preloader', Preloader, false);            this.state.add('MainMenu', MainMenu, false);            this.state.add('Level1', Level1, false);

Each of the this.state.add fails with:

1>C:\code\cardgame\cardgame\Game.ts(11,24): error TS2082: Build: Supplied parameters do not match any signature of call target:
1>C:\code\cardgame\cardgame\Game.ts(11,24): error TS2087: Build: Could not select overload for 'call' expression.

 

Howevering over the line also gives: Type 'typeof Castlevania.Boot is missing property 'game' from type 'Phaser.State''.

 

All the classes inherit from Phaser.state, for example in Boot.ts:

module Castlevania {    export class Boot extends Phaser.State {

Any idea what is wrong? As stated, it's copy-paste of the tutorial..

 

Kind Regards, Jack.

Link to comment
Share on other sites

You should grab the latest TypeScript definitions file from the dev branch - when I say latest, I mean literally pushed up about 2 minutes ago. It should compile fine then.

 

If you find things wrong in the def file (missing properties, types, etc) then PLEASE let me know, ideally with a fix - a Pull Request would be best, but happy to have it as an email or forum post or whatever, but it needs more TypeScript devs to help get it really solid.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...