型にオブジェクト{}を指定
by s_hiroshi
TypeScript
class Point {
// オブジェクト型
private point: {};
constructor(point: {}) {
this.point = point;
}
size() {
return Math.sqrt(Math.pow(this.point.x, 2) + Math.pow(this.point.y, 2));
}
}
const o = new Point({
x: 20,
y: 30
});
console.log(o.size());