コピペコードで快適生活

明日使えるソースを自分のために

npmライブラリで型情報を提供するには

https://typescriptbook.jp/reference/declaration-file に書いてあった。

Phaserの場合

Phaserの場合は「JavaScriptで書かれたパッケージだが.d.tsファイルを同梱している」に該当する。

型定義ファイルの場所はpackage.jsonに記載がある。 https://github.com/photonstorm/phaser/blob/v3.55.2/package.json#L12

"types": "./types/phaser.d.ts",

Phaserの場合は、型生成ツールを使って作成しているようだ。 https://github.com/photonstorm/phaser/tree/5c8ecbcf999e6f328d21884e877c9e5935d2d350/scripts/tsgen