Jump to content

TypeScript errors


oxysoft
 Share

Recommended Posts

I am trying to use TypeScript with phaser and I am getting the following errors

Error    7    Class 'TileSprite' incorrectly extends base class 'TilingSprite':  Types of property 'destroy' are incompatible:    Type '(destroyChildren: boolean) => void' is not assignable to type '() => void'.    c:\Users\oxysoft\documents\visual studio 2013\Projects\flint-game\flint-game\phaser.d.ts    4270    11    flint-game

 
I have added Phaser.js, Phaser.js.min, Phaser.d.ts and Pixi.d.ts and it is not working

 

Thanks

Link to comment
Share on other sites

I had that problem too.  I just changed the 'TilingSprite.destroy' definition in pixi.d.ts to match the TileSprite.destroy definition in Phaser.d.ts (maybe the other way around...), so that they both read:

destroy(destroyChildren: boolean): void;

Just make sure you choose to add function parameters rather than remove them.  If one application doesn't use them it's not going to hurt for them to be there... yay javascript :)

Link to comment
Share on other sites

I also had this problem and noticed that it is fixed in the dev branch by simply changing the TileSprite.destroy(destroyChildren: boolean) to TileSprite.destroy(destroyChildren?: boolean).  This makes the parameter optional and there is already logic in the TileSprite.destroy() method to handle the parameter not being provided.  This is probably a safer work-around.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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