Karma Octopus Posted December 23, 2013 Share Posted December 23, 2013 It seems that the TypeScript definition for Phaser.Animation.generateFrameNames is missing. I think that's the problem since the function seems to be in the Phaser JS but I can't use that function in TS. Link to comment Share on other sites More sharing options...
Karma Octopus Posted December 23, 2013 Author Share Posted December 23, 2013 Another error in the TypeScript definitions file (I think) is that the frames property on makeParticles in Particles.Arcade.Emitter should be of type: number and not string[]. Right?: makeParticles( keys: string[], frames: number, quantity: number, collide: boolean, collideWorldBounds: boolean): Phaser.Particles.Arcade.Emitter; Current: makeParticles( keys: string[], frames: string[], quantity: number, collide: boolean, collideWorldBounds: boolean): Phaser.Particles.Arcade.Emitter; Link to comment Share on other sites More sharing options...
rafaholiveira Posted December 24, 2013 Share Posted December 24, 2013 You can edit phaser.d.ts manually, and include the missing definitions. I have a list of things to include/change, but I need to review first before send to the Repo. Link to comment Share on other sites More sharing options...
rich Posted December 26, 2013 Share Posted December 26, 2013 Yes the TypeScript definitions really need some community love and attention, as I know they're not 100% accurate (although better than nothing!), so anything spotted would be gratefully received as a pull request on github Link to comment Share on other sites More sharing options...
tackle Posted December 26, 2013 Share Posted December 26, 2013 Rich do you know if the source of phaser.d.ts should be enough up to date to run the simple code outlined here:http://www.photonstorm.com/phaser/how-to-use-phaser-with-typescript Had some problems initially (was on VS2012, updated to VS2013 fixed that). Thought I was clear, but I'm getting tons of error right of the bat when trying to compile the first go:Error 34 Build: Supplied parameters do not match any signature of call target. C:\Projekt\GameHyperia\GameHyperia\app.ts 4 32 GameHyperiaError 35 Build: Could not select overload for 'new' expression. C:\Projekt\GameHyperia\GameHyperia\app.ts 4 32 GameHyperiaError 36 Build: Generic type references must include all type arguments. C:\Projekt\GameHyperia\GameHyperia\phaser.d.ts 4 21 GameHyperiaError 37 Build: Duplicate identifier 'stage'. C:\Projekt\GameHyperia\GameHyperia\phaser.d.ts 65 13 GameHyperiaError 38 Build: Generic type references must include all type arguments. C:\Projekt\GameHyperia\GameHyperia\phaser.d.ts 147 21 GameHyperiaError 39 Build: Generic type references must include all type arguments. C:\Projekt\GameHyperia\GameHyperia\phaser.d.ts 148 33 GameHyperiaError 40 Build: Generic type references must include all type arguments. C:\Projekt\GameHyperia\GameHyperia\phaser.d.ts 904 32 GameHyperia[...tons of errors omitted for brevity...]Error 65 Build: Generic type references must include all type arguments. C:\Projekt\GameHyperia\GameHyperia\phaser.d.ts 1798 80 GameHyperiaError 66 Build: Generic type references must include all type arguments. C:\Projekt\GameHyperia\GameHyperia\phaser.d.ts 1800 46 GameHyperiaFirst error is for calling new Phaser.Game Sorry I can't be more descriptive than that, still just getting around with typescript so far Edit: Ok so after some tinkering I got it to compile.I added two arguments to the new constructor call. Then I added TONS of <Object> type declarations to wherever the IDE showed an Array to be erroneous.Am I going about it the right way? At the start of the file I have:static GAMES: Array<Phaser.Game>;But as for the rest of them (generics I think?) I just put Object. Link to comment Share on other sites More sharing options...
rich Posted December 27, 2013 Share Posted December 27, 2013 Yes the defs file works on that code, but ONLY if pulled from the dev branch and not master. It will move to master when we release 1.1.4 next week. tackle 1 Link to comment Share on other sites More sharing options...
tackle Posted December 27, 2013 Share Posted December 27, 2013 Ok cool! Link to comment Share on other sites More sharing options...
rafaholiveira Posted December 27, 2013 Share Posted December 27, 2013 A easy way of change phaser.d.ts, is do a right-click in the class, and choose go to definition. Then check the definition in http://gametest.mobi/phaser/docs/ and put in the end of the class. Some properties of Sprite are inherited from Pixi DisplayObject, like Alpha. In this case I put directly in the Sprite class, for my use. But maybe for the repo this is not the best way. Link to comment Share on other sites More sharing options...
Recommended Posts