mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-01-18 05:59:14 +01: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:
commit
3e4fc3f2a8
@ -114,7 +114,7 @@ class Point {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Functions
|
// 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 members
|
||||||
static origin = new Point(0, 0);
|
static origin = new Point(0, 0);
|
||||||
@ -137,7 +137,7 @@ class Point3D extends Point {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Overwrite
|
// Overwrite
|
||||||
dist() {
|
dist(): number {
|
||||||
let d = super.dist();
|
let d = super.dist();
|
||||||
return Math.sqrt(d * d + this.z * this.z);
|
return Math.sqrt(d * d + this.z * this.z);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user