SyntaxError: /Users/nishio/regroup/src/onOverlayCanvas.ts: `import =` is not supported by @babel/plugin-transform-typescript
Please consider using `import <moduleName> from '<moduleName>';` alongside Typescript's --allowSyntheticDefaultImports option.
> 2 | import paper = require("paper");
素直なimport paper from "paper";でちゃんと動いた。なんだこれでよかったのか。
検索したらvar paper = require("paper");なんてのまであった。varを使うなんて!
window.app.paperをimport paper from "paper";に変えていく。
おや、新しい型エラーだ
ts
Argument of type 'HTMLElement | null' is not assignable to parameter of type 'string | HTMLCanvasElement'.
Type 'null' is not assignable to type 'string | HTMLCanvasElement'. TS2345
50 | // Get a reference to the canvas object
51 | const canvas = document.getElementById("myCanvas");
> 52 | paper.setup(canvas);