Typescript Definition File for p2.js
clark-stevenson / p2.d.ts Goto Github PK
View Code? Open in Web Editor NEWTypescript Definition File for p2.js https://github.com/schteppe/p2.js
License: MIT License
Typescript Definition File for p2.js https://github.com/schteppe/p2.js
License: MIT License
Typescript Definition File for p2.js
I've, downloaded the p2 package via npm for nodejs.
How do I use the p2.d.ts with this package? Can you give an example?
/// <reference path='../typings/p2/p2.d.ts' />
import p2 = require('p2'); // <---- this causes 'p2 module not found' error (TS2307)
import GameObject = require('./GameObjectNew');
import player = require('./asset/PlayerNew');
class Game {
gameObjects: GameObject[] = [];
players: GameObject[] = [];
sessionEvents = [];
globalEvents = [];
world: p2.World = new p2.World({
gravity: [0.0, 0.0]
});
.........
It seems Schteppe has somehow found the time to do definition files officially on the project:
https://github.com/schteppe/p2.js > index.d.ts
For that reason, this seems superfluous now? Should I remove the definitions and point to the official defs?
p2 uses an array length 2 of number type to define vector such as position. number[] is annoying but works.
Does anyone have any issues with changing all number[](in context) to something like this? I suppose finding the correct name is my problem since vec2 exists already as a class with static members.
export interface IVec2 extends Array<number | number> {
0?: number;
1?: number;
}
Any opinion would be great.
Hey! Thanks for writing this definition file.
I was wondering if there's a reason you haven't submitted it as a pull request to https://github.com/borisyankov/DefinitelyTyped/? Would be nice to be able to use it with tsd
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.