Ionic2 Ionic项目类型脚本错误
我刚刚安装了ionic、cordova,并创建了一个空项目。 每次启动ionic serve时,它都会显示带有以下类型脚本错误的浏览器页面:Ionic2 Ionic项目类型脚本错误,ionic2,typescript-typings,Ionic2,Typescript Typings,我刚刚安装了ionic、cordova,并创建了一个空项目。 每次启动ionic serve时,它都会显示带有以下类型脚本错误的浏览器页面: **Typescript Error** All declarations of 'size' must have identical modifiers. node_modules/typescript/lib/lib.es2015.collection.d.ts get(key: K): V | undefined; has(key: K): boo
**Typescript Error**
All declarations of 'size' must have identical modifiers.
node_modules/typescript/lib/lib.es2015.collection.d.ts
get(key: K): V | undefined;
has(key: K): boolean;
set(key: K, value: V): this;
Typescript Error
All declarations of 'prototype' must have identical modifiers.
node_modules/typescript/lib/lib.es2015.collection.d.ts
new (): WeakMap<object, any>;
new <K extends object, V>(entries?: [K, V][]): WeakMap<K, V>;
readonly prototype: WeakMap<object, any>;
本地套餐:
@ionic/cli-utils : 1.4.0
Ionic CLI : 3.4.0
@ionic/app-scripts : 1.3.12
@ionic/cli-plugin-ionic-angular : 1.3.1
Ionic Framework : ionic-angular 3.5.0
Node : v7.2.0
OS : OS X El Capitan
Xcode : Xcode 8.2.1 Build version 8C1002
ios-deploy : not installed
ios-sim : not installed
npm : 4.1.1
系统:
@ionic/cli-utils : 1.4.0
Ionic CLI : 3.4.0
@ionic/app-scripts : 1.3.12
@ionic/cli-plugin-ionic-angular : 1.3.1
Ionic Framework : ionic-angular 3.5.0
Node : v7.2.0
OS : OS X El Capitan
Xcode : Xcode 8.2.1 Build version 8C1002
ios-deploy : not installed
ios-sim : not installed
npm : 4.1.1
不确定这是否是正确的解决方案,我所做的是在tsconfig.json中 我将类型设置为空数组:
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",
"types": []
这家伙还建议安装typings-lodash(npm-install@types/lodash--save-dev--save-exact)
然后我设置了“类型”:[“lodash”],这也是可行的。如果有更好的解决方案,请给出任何意见。因为在我的另一个项目中,它没有解决所有问题,不确定它是否是一个项目问题,或者仍然是由于typescript你的typescript版本是什么?