I am building a Typescript application, and I'm using an external js library (pixi.js for rendering). I have the .d.ts file and it's all working fine.
The file declares a class Point:
export class Point {
x: number;
y: number;
constructor(x?: number, y?: number);
clone(): Point;
copy(p: Point): void;
equals(p: Point): boolean;
set(x?: number, y?: number): void;
}
I was wondering if there was any decent way to add functionality to this, or other, classes that are declared in a .d.ts file. For example, in this case, I could really use an add(), subtract(), negate() method and so on.
EDIT: To clarify, I do not want to extend this class by way of creating a subclass. I want to add functionality to the class itself. I don't want to have to deal with two classes (e.g. Point and PointEx) in my code - pixi uses Point internally and often returns it from functions, so I don't want the added overhead of casting Point to the extended object.