I am having problems while overloading constructors, it won't let me tell it what type is what the variable contains. How can I force a type, or make this work anyway...?
constructor(points: Point[], name?: string); constructor(walls: Wall[], name?: string); constructor(pointsOrWalls: (Wall | Point)[], name?: string) { if (pointsOrWalls[0] instanceof Point) { // If first is Point all must be Points // But here typescript says that pointsOrWalls is of type (Wall | Point)[] this.walls = pointsOrWalls.map(function(point, ind, points) { return new Wall(point, points[++ind % points.length]) }) }else{ // Since these aren't points they are Walls this.walls = walls } this.name = name }