export class Point { public x:number; public y:number; constructor(x:number, y:number) { this.x = x; this.y = y; } } export class Polygon extends Array<Point> { public translate(x:number, y:number): Polygon { const newCorners = new Polygon(); for(const corner of this) { newCorners.push(new Point(corner.x + x, corner.y + y)); } return newCorners; } }