【问题标题】:Ionic App, Typescript Error Cannot find name 'RequestMode'离子应用程序,打字稿错误找不到名称'RequestMode'
【发布时间】:2018-01-22 00:15:07
【问题描述】:

我的 ionic 应用程序出现问题,在 ionic 和 angular servicestack 中的一些更新后出现如下错误

Typescript 错误找不到名称“RequestMode”。 node_modules/servicestack-client/src/index.d.ts

oneWayBaseUrl: string;
mode: RequestMode;
credentials: RequestCredentials;

Typescript 错误找不到名称“RequestCredentials”。 node_modules/servicestack-client/src/index.d.ts

mode: RequestMode;
credentials: RequestCredentials;
headers: Headers;

我的 ionic、angular 和 pc 信息

Typescript : 2.4.2
Ionic Framework: 3.1.1
Ionic App Scripts: 1.3.4
Angular Core: 4.0.2
Angular Compiler CLI: 4.0.2
Node: 6.10.0
OS Platform: macOS Sierra
Navigator Platform: MacIntel
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36

tsconfig.json 文件

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "module": "commonjs",
    "lib": ["dom","es2015"],
    "moduleResolution": "node",
    "sourceMap": true
  },
  "include": [
    "src/**/*.ts",
    "typings/**/*.ts"
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

【问题讨论】:

    标签: angular ionic2 servicestack ionic3


    【解决方案1】:

    这是使用最新的v2.4.2 of typescripttsconfig.json that servicestack-client was built with,它引用TypeScript 内置lib.dom.d.ts 中的W3C 提取类型,因此如果您引用lib dom,您将可以访问这些缺失的类型.

    不确定您的项目有什么问题,但我会调查任何可能导致类型定义冲突的问题,例如任何可能导致冲突的 typings/*

    【讨论】:

      猜你喜欢
      • 2017-11-09
      • 1970-01-01
      • 1970-01-01
      • 2019-04-30
      • 2017-06-18
      • 1970-01-01
      • 2023-03-17
      • 2017-12-01
      • 1970-01-01
      相关资源
      最近更新 更多