markloika Posted March 4, 2015 Share Posted March 4, 2015 I'm trying to get up and running with Phaser and TypeScript. Following the instructions here:http://www.photonstorm.com/phaser/how-to-use-phaser-with-typescript This does appear to be out of date though as phaser.d.ts is not in the build folder, so I copied phaser.js and phaser.min.js from the build folder and phaser.d.ts and pixi.d.ts from the typescript folder, and added these 4 files to my project. Now when trying to compile in VS, I get the following two errors:Error 1 Class 'Phaser.TileSprite' cannot extend class 'PIXI.TilingSprite':Types of property 'destroy' of types 'TileSprite' and 'PIXI.TilingSprite' are incompatible:Call signatures of types '(destroyChildren: boolean) => void' and '() => void' are incompatible:Call signature expects 0 or fewer parameters. C:\Users\Mark\Product Development\In Progress\TypeScript Learning\TypeScryptHelloWorld\TypeScryptHelloWorld\phaser.d.ts 4270 11 TypeScriptHelloWorldError 2 Build: Class 'Phaser.TileSprite' cannot extend class 'PIXI.TilingSprite': C:\Users\Mark\Product Development\In Progress\TypeScript Learning\TypeScryptHelloWorld\TypeScryptHelloWorld\phaser.d.ts 4270 11 TypeScriptHelloWorldI found a post from 2013 that would seem to indicate this issue was solved literally years ago: Actually sorry this is a mistake on my part. TileSprite shouldn't extend Phaser.Sprite at all. I've updated the code and docs to remove this. The issue is that TileSprites work so differently from normal Pixi sprites that you simply can't extend them in the same way. Getting Input to work would require rewriting Pixi.TileSprite which I don't want to do right now, sorry. http://www.html5gamedevs.com/topic/2331-adding-input-events-to-tilesprite-throwing-exceptions/ So I'm pretty confused as to what's going on as I just now downloaded Phaser from the git repo. Any help would be appreciated! Link to comment Share on other sites More sharing options...
rich Posted March 4, 2015 Share Posted March 4, 2015 Try using the TS defs from the dev branch: https://github.com/photonstorm/phaser/tree/dev/typescript Pretty sure the destroy issue is fixed in there. clark 1 Link to comment Share on other sites More sharing options...
Recommended Posts