Skip to content

Added typescript definitions#12

Merged
hexus merged 1 commit intohexus:masterfrom
IkonOne:master
Aug 16, 2016
Merged

Added typescript definitions#12
hexus merged 1 commit intohexus:masterfrom
IkonOne:master

Conversation

@IkonOne
Copy link
Copy Markdown
Contributor

@IkonOne IkonOne commented Aug 16, 2016

No description provided.

@hexus
Copy link
Copy Markdown
Owner

hexus commented Aug 16, 2016

Thanks! I don't know much about typescript but I'll merge this in and include as part of 0.2.0.

Is this all that's needed to get it working with the language?

@IkonOne
Copy link
Copy Markdown
Contributor Author

IkonOne commented Aug 16, 2016

Yes it is. A person using typescript would simply copy the .d.ts file next to the phaser.d.ts file in their project structure, include a reference to it in their project and voila, code completion baby!

There are definitely errors and things missing with the definition though so I'll fix and send pull requests as I run into them.

@hexus
Copy link
Copy Markdown
Owner

hexus commented Aug 16, 2016

Okay, sounds great. I'm happy to entrust you with the typescript definitions and let you know of any API changes as they develop. 😉

@hexus hexus merged commit 3963f55 into hexus:master Aug 16, 2016
enableBody(body:Phaser.Physics.Arcade.Body):void;
convertTilemap(map:Phaser.Tilemap, layer:number | string | Phaser.TilemapLayer, slopeMap:Object):Phaser.Tilemap;
convertTilemapLayer(layer:Phaser.TilemapLayer, slopeMap:Object):Phaser.TilemapLayer;
collide(i:number, body:Phaser.Physics.Arcade.Body, tile:Phaser.Tile, overlapOnly:boolean):boolean;
Copy link
Copy Markdown
Owner

@hexus hexus Aug 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed this collide definition isn't right, and same with the above in the plugin definition.

They seem to be duplicated from the SatSolver#collide definition below, which is correct, but these two up here are different; public-facing rather than internal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not following what is wrong. All three of those classes have identical collide definitions in the source:

https://github.com/hexus/phaser-arcade-slopes/blob/master/src/ArcadeSlopes.js#L196
https://github.com/hexus/phaser-arcade-slopes/blob/master/src/ArcadeSlopes/SatSolver.js#L493
https://github.com/hexus/phaser-arcade-slopes/blob/master/src/ArcadeSlopes/Facade.js#L145

Are you referencing the i:number part? If that's the case, Type/Javascript don't have an integer type.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I was recalling Phaser's collision method. :) Too many methods called collide to remember correctly. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants