Slide 18
Slide 18 text
18
© toggle holdings inc.
カテゴリ 型エラーの例 修正方法
間違った型の引数を
渡す
new paper.Point("100", "200") new paper.Point(100, 200)
無効なオブジェクト testLayer.addChild({ x: 100, y: 100 }) testLayer.addChild(circle)
メソッドの誤用 point.add(50) point.add(new paper.Point(50, 50))
間違ったオブジェク
トでメソッドを呼ぶ
point.addChild(circle) layer.addChild(circle)
演算結果の型ミス const addPoint: number =
point.add(new paper.Point(50, 50))
const addPoint: paper.Point =
point.add(new paper.Point(50, 50))
型安全