1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-01 04:20:39 +02:00

Merge pull request #3890 from vitiral/ts-fixes

[typescript/en-us] add type to Point.dist and fix error
This commit is contained in:
Max Schumacher
2020-08-17 16:13:16 +02:00
committed by GitHub

View File

@@ -114,7 +114,7 @@ class Point {
}
// Functions
dist() { return Math.sqrt(this.x * this.x + this.y * this.y); }
dist(): number { return Math.sqrt(this.x * this.x + this.y * this.y); }
// Static members
static origin = new Point(0, 0);
@@ -137,7 +137,7 @@ class Point3D extends Point {
}
// Overwrite
dist() {
dist(): number {
let d = super.dist();
return Math.sqrt(d * d + this.z * this.z);
}