jeudi 21 décembre 2017

Error regarding types in tsconfig when in testing or in normal production

In ionic 3 app

tscofig.json

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

Problem

Removing types:["node","jasmine"] it throws TS2304: Cannot find name 'require'. when testing. Normal production works fine.

Adding types:["node","jasmine"] it throws typescript. Cannot find type definition file for 'jasmine'. when in normal production. Testing works fine.

Version info

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : android 6.3.0 browser 5.0.1
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v6.11.2
npm               : 5.5.1
OS                : Windows 7

Aucun commentaire:

Enregistrer un commentaire