首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何修正离子3中的打字错误?index.d.ts

如何修正离子3中的打字错误?index.d.ts
EN

Stack Overflow用户
提问于 2020-01-14 06:58:00
回答 1查看 2.2K关注 0票数 1

这就是我现在所犯的错误

这是我的package.json

{“名称”:"Ambusis",“版本”:"0.0.1",“作者”:“离子框架”,“主页”:"http://ionicframework.com/",“私有”:真,“脚本”:{“干净”:“离子-应用-脚本清洁”,“构建”:“离子-应用-脚本构建”," lint“:”离子-应用-脚本林特“,“离子:构建”:“离子-应用-脚本构建”,“离子:服务”:“离子-应用-脚本服务”},

代码语言:javascript
复制
  "dependencies": {
    "@angular/animations": "5.2.9",
    "@angular/common": "5.2.9",
    "@angular/compiler": "5.2.9",
    "@angular/compiler-cli": "5.2.9",
    "@angular/core": "5.2.9",
    "@angular/fire": "^5.3.0",
    "@angular/forms": "5.2.9",
    "@angular/http": "5.2.9",
    "@angular/platform-browser": "5.2.9",
    "@angular/platform-browser-dynamic": "5.2.9",
    "@angular/router": "^3.4.10",
    "@ionic-native/browser-tab": "^4.7.0",
    "@ionic-native/core": "4.6.0",
    "@ionic-native/diagnostic": "^4.7.0",
    "@ionic-native/firebase": "^5.19.1",
    "@ionic-native/geolocation": "^4.7.0",
    "@ionic-native/in-app-browser": "^4.7.0",
    "@ionic-native/location-accuracy": "^4.7.0",
    "@ionic-native/network": "^4.7.0",
    "@ionic-native/social-sharing": "^4.7.0",
    "@ionic-native/splash-screen": "4.6.0",
    "@ionic-native/status-bar": "4.3.1",
    "@ionic/storage": "2.1.3",
    "cordova-android": "8.1.0",
    "cordova-plugin-browsertab": "^0.2.0",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.1",
    "cordova-plugin-firebase": "^2.0.5",
    "cordova-plugin-geolocation": "^4.0.1",
    "cordova-plugin-inappbrowser": "^3.2.0",
    "cordova-plugin-ionic-keyboard": "^2.0.5",
    "cordova-plugin-ionic-webview": "^4.1.2",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-request-location-accuracy": "^2.2.2",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-x-socialsharing": "^5.4.0",
    "cordova.plugins.diagnostic": "^4.0.5",
    "es6-promise-plugin": "^4.2.2",
    "firebase": "^7.6.2",
    "ionic-angular": "^3.9.9",
    "ionic2-rating": "^1.2.2",
    "ionic2-super-tabs": "^4.2.2",
    "ionicons": "3.0.0",
    "pkg.json": "^2.0.7",
    "rxjs": "5.5.8",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.20"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.2.4",
    "@ionic/lab": "2.0.18",
    "typescript": "~3.1.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-network-information": {},
      "cordova-plugin-geolocation": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova.plugins.diagnostic": {
        "ANDROID_SUPPORT_VERSION": "28.+"
      },
      "cordova-plugin-request-location-accuracy": {
        "PLAY_SERVICES_LOCATION_VERSION": "16.+"
      },
      "cordova-plugin-x-socialsharing": {
        "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
      },
      "cordova-plugin-browsertab": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-firebase": {}
    },
    "platforms": [
      "android"
    ]
  }
}

这就是它所指的代码。

代码语言:javascript
复制
export type CustomEventName<T> = T extends EventNameString ? never : T;

这是我的tsconfig.json

代码语言:javascript
复制
{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "src/**/*.spec.ts",
    "src/**/__tests__/*.ts"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

如果我保存了一个文件,它就会被修复

谢谢,伙计们!

编辑:

遵照约翰爵士的建议,现在只剩下一个错误了。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-01-14 08:44:57

好的,添加skipLibCheck,这样它就可以跳过编译时对所有声明文件(*.d.ts)的类型检查。

应该是这样

代码语言:javascript
复制
{
  "compilerOptions": {
    "skipLibCheck": true,
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "src/**/*.spec.ts",
    "src/**/__tests__/*.ts"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59728844

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档