Since v2.8.2 Phaser's definitions will likely be found automatically when Phaser is installed with npm.
If necessary, reference phaser.d.ts (or phaser.comments.d.ts) in your project. phaser.d.ts
, pixi.d.ts
, p2.d.ts
must remain siblings in the same directory.
Using tsconfig.json
{
"files": [
"PATH/TO/phaser.d.ts"
]
}
For npm-installed Phaser, the path will be ./node_modules/phaser-ce/typescript/phaser.d.ts
.
You can use typings, the TypeScript Definition Manager, to include Phaser's typescript definitions in your project:
- Make sure that typings is installed in your system:
npm install -g typings
- Install phaser typescript definitions as a global dependency:
typings install github:photonstorm/phaser-ce/typescript/typings.json -GD
This will make phaser typescript definitions available for your compiler so that there is no need to reference them from your source files. For more information, check the official typings site.
If you find any mistakes in these definitions or you feel they can be improved in any way, please open an issue or make a pull request.
Creature
defs are not yet provided.
The Box2D defs come from https://github.com/SBCGames/Phaser-Box2D-Typescript-defs.