角型1をTypescriptで使用しようとしています。私は型宣言ファイルをフェッチするためにnpm @typesを使用しています。 Webstormは型定義を認識し、私はtsc
を実行すると、出力は以下の通りです:モジュール 'angular'にエクスポートされたメンバ 'material'がありません
node_modules/@types/angular-material/index.d.ts(6,26): error TS2307: Cannot find module 'angular'.
node_modules/@types/angular-ui-router/index.d.ts(6,26): error TS2307: Cannot find module 'angular'.
src/core.config.ts(9,68): error TS2305: Module 'angular' has no exported member 'ui'.
src/core.config.ts(19,16): error TS2339: Property 'name' does not exist on type '{}'.
src/core.config.ts(37,43): error TS2305: Module 'angular' has no exported member 'ui'.
src/core.controller.ts(6,80): error TS2305: Module 'angular' has no exported member 'material'.
マイTSconfigのファイルは次のようになります。
{
"compilerOptions": {
"module": "system",
"noImplicitAny": true,
"removeComments": true,
"preserveConstEnums": true,
"outFile": "out.min.js",
"sourceMap": true,
"typeRoots": [
"./node_modules/@types"
],
"types": [
"angular",
"angular-material",
"angular-ui-router"
]
},
"files": ["file.ts"]
}
私が定義について(/// <reference path="node_modules/@types/angular-material/index.d.ts" />
)参照パスを追加しようとしましたファイルには役立ちませんでした。私は何かが間違っているように感じるが、私は何を見つけることができませんでした。誰かが私が行方不明を知っていますか?
編集
私は私が私のtsconfig.jsonファイルを使用してコンパイルするときに私はエラーのみを取得することが分かりました。 tsc core.config.ts
を使用すると、エラーはありませんが、私のtsconfigファイルの["core.config.ts"]ファイルでは、上記のエラーと同じエラーが表示されます。
'@ types/angular'をインストールしましたか? – goenning
はい、私はそれをインストールしました。アンインストールしてもう一度インストールしようとしましたが、それもうまくいきませんでした。 – KrisM