打字稿错误 后续变量声明必须具有相同的类型



Typescript Error

后续变量声明必须具有相同的类型。变量 "驱动程序"的类型必须是"字符串 |字符串[]',但这里有类型 '字符串 |本地饲料驱动程序 |LocalForageDriver[]'.

后续变量声明必须具有相同的类型。变量 "版本"必须是"数字"类型,但此处的类型为"字符串"。

package.json
{
"name": "Test",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "2.4.8",
"@angular/compiler": "2.4.8",
"@angular/compiler-cli": "2.4.8",
"@angular/core": "2.4.8",
"@angular/forms": "2.4.8",
"@angular/http": "2.4.8",
"@angular/platform-browser": "2.4.8",
"@angular/platform-browser-dynamic": "2.4.8",
"@angular/platform-server": "2.4.8",
"@ionic-native/core": "^3.1.1",
"@ionic-native/in-app-browser": "^3.1.1",
"@ionic/storage": "^1.1.7",
"ionic-angular": "2.2.0",
"ionic-native": "^2.4.1",
"ionicons": "^3.0.0",
"localforage": "^1.7.3",
"localforage-cordovasqlitedriver": "^1.8.0",
"node-sass": "^4.12.0",
"rxjs": "5.0.1",
"sw-toolbox": "^3.4.0",
"zone.js": "0.7.2"
},
"devDependencies": {
"@ionic/app-scripts": "^1.1.3",
"typescript": "^2.0.9"
},
"cordovaPlugins": [
"cordova-plugin-splashscreen",
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"ionic-plugin-keyboard",
"cordova-plugin-nativestorage",
"cordova-plugin-inappbrowser"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "appture2: An Ionic project"
}

后续变量声明必须具有相同的类型。变量 "_support"的类型必须是"布尔值 |LocalForageDriverSupportFunc', 但这里有类型'布尔值 |答应'。

从你的包.json我可以看到你设置了

"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "", //< -- string
"locator": "ios"
}
],

试试这个:

"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": 1, //<--set as number
"locator": "ios"
}
],

希望它能跟上你!

相关内容

  • 没有找到相关文章

最新更新