ファブリックのタイプ定義をインストールしようとしていますが(https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/fabric/)、正しいタイピングコマンドを理解できません。ファブリックの.d.tsのインストール方法
最初に私はtypings install dt~fabric --global --save
を試してみましたが、次のエラーを得た: $typings install dt~fabric --global --save typings ERR! message Attempted to compile "fabric" as a global module, but it looks like an external module. You'll need to remove the global option to continue.
その後、私はタイピングが成功コマンドが、typings/modules/fabric/index.d.ts
ファイルは元のファイルhttps://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/fabric/index.d.ts
と異なった、typings install dt~fabric --save
を試してみました。 typings
コマンドは元のコンテンツをdeclare module 'fabric' {}
でラップします。これにより、.d.tsファイル内のexport as namespace fabric;
というステートメントにコンパイラエラーError:(9, 1) TS1316:Global module exports may only appear at top level.
が発生します。
タイピング版サイトファブリックを学び、そしてそれが巨大助けたとき、私はこれを使用しtype definitions here.
を見ることができますper the NPM docs.
2.1.0
'npm install --save @ types/fabric'を試しましたか? –
'@ types/fabric'はありません – Smartkid
私は確信しています。スペルミスが間違っていましたか? –