From dd156b936d490d2a1d58dd55190c36e5e5bc4b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Thu, 7 Sep 2023 03:29:53 +0000 Subject: [PATCH] ts overload constructors --- ui/src/lib/door.ts | 2 ++ ui/src/lib/rectangle.ts | 2 ++ ui/src/lib/vector2d.ts | 2 ++ 3 files changed, 6 insertions(+) diff --git a/ui/src/lib/door.ts b/ui/src/lib/door.ts index a0b2b86..17b244e 100644 --- a/ui/src/lib/door.ts +++ b/ui/src/lib/door.ts @@ -4,6 +4,8 @@ export class Door { private _day = -1; public position: Rectangle; + constructor(position: Rectangle); + constructor(position: Rectangle, day: number); constructor(position: Rectangle, day = -1) { this.day = day; this.position = position; diff --git a/ui/src/lib/rectangle.ts b/ui/src/lib/rectangle.ts index 455fbcf..3c7ec63 100644 --- a/ui/src/lib/rectangle.ts +++ b/ui/src/lib/rectangle.ts @@ -4,6 +4,8 @@ export class Rectangle { private readonly corner_1: Vector2D; private readonly corner_2: Vector2D; + constructor(); + constructor(corner_1: Vector2D, corner_2: Vector2D); constructor(corner_1 = new Vector2D(), corner_2 = new Vector2D()) { this.corner_1 = corner_1; this.corner_2 = corner_2; diff --git a/ui/src/lib/vector2d.ts b/ui/src/lib/vector2d.ts index 2d342a8..2f7d799 100644 --- a/ui/src/lib/vector2d.ts +++ b/ui/src/lib/vector2d.ts @@ -2,6 +2,8 @@ export class Vector2D { public readonly x: number; public readonly y: number; + constructor(); + constructor(x: number, y: number); constructor(x = 0, y = 0) { this.x = x; this.y = y;