错误TS2304:在角度4项目的app.components.ts和main.ts文件中找
发布时间:2020-12-17 18:06:25 所属栏目:安全 来源:网络整理
导读:打字稿新手.使用neo vim,ubuntu 16.04和各种vim打字稿插件tsuquyomi,leafgarland / typescript-vim,mhartington / nvim-typescript,我很确定我正确配置它们. 我成功安装了@ angular / cli,我正在尝试完成教程但是我有一个我不明白的错误. `1 .._modules/@ang
打字稿新手.使用neo
vim,ubuntu 16.04和各种vim打字稿插件tsuquyomi,leafgarland / typescript-vim,mhartington / nvim-typescript,我很确定我正确配置它们.
我成功安装了@ angular / cli,我正在尝试完成教程但是我有一个我不明白的错误. `1 .._modules/@angular/core/src/change_detection/differs/default_iterable_differ.d.ts|| TS2304: Cannot find name 'Iterable'. 2 ../node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts|| TS2304: Cannot find name 'Map'. 3 ../node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts|| TS2304: Cannot find name 'Map'. 4 ../node_modules/@angular/core/src/change_detection/differs/iterable_differs.d.ts|| TS2304: Cannot find name 'Iterable'. 5 damn/node_modules/@angular/core/src/change_detection/differs/keyvalue_differs.d.ts|| TS2304: Cannot find name 'Map'. 6 ..//node_modules/@angular/core/src/di/reflective_provider.d.ts|| TS2304: Cannot find name 'Map'. 7 ../node_modules/@angular/core/src/di/reflective_provider.d.ts|| TS2304: Cannot find name 'Map'. 8 ../node_modules/rxjs/Observable.d.ts|| TS2693: 'Promise' only refers to a type,but is being used as a value here.` 我尝试了所有我猜的 尝试以下tsconfig filesGlob属性: "filesGlob": [ "main.ts","typings.d.ts","app/**/*.ts","!app/**/*.spec.ts" ], 安装angular / core-js和@ types / core-js和typings npm install --save-dev @types/core-js npm install @types/node --save 编辑过的tsconfig.json文件 { "compileOnSave": false,"compilerOptions": { "outDir": "./dist/out-tsc","sourceMap": true,"declaration": false,"moduleResolution": "node","emitDecoratorMetadata": true,"experimentalDecorators": true,"target": "es5","types": ["node"],"typeRoots": [ "node_modules/@types" ],"files": [ "main.ts","typings.d.ts" ],"filesGlob": [ "main.ts","app/**/*.ts" ],"lib": [ "es2016","dom" ] } } 我还编辑了tsconfig.app.json文件 { "extends": "../tsconfig.json","compilerOptions": { "outDir": "../out-tsc/app","baseUrl": "./","module": "es2015","types": [],"typeRoots": [ "../node_modules/@types/" ] },"exclude": [ "test.ts","**/*.spec.ts" ] } 但是,我的app.components.ts文件和main.ts中的错误仍然存??在,尽管所有这些更改. 解决方法
添加“skipLibCheck”:true到tsconfig.json中的“compilerOptions”
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |