John Abraham
John Abraham

Reputation: 18781

TS:2304 cannot find Jasmine definitions in WebStorm 2017.3 with Angular CLI

Angular by default has included @types/jasmine. Moreover, the types are include in the tsconfig.spec.ts

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/spec",
    "module": "commonjs",
    "target": "es5",
    "baseUrl": "",
    "types": [
      "jasmine",
      "node"
    ]
  },
  "files": [
    "test.ts"
  ],
  "include": [
    "**/*.spec.ts",
    "**/*.d.ts"
  ]
}

W/O the definitions I can still click into the definition files which is weird:

enter image description here

enter image description here

My describe will only work if I reference the path directly which is bad practice:

///<reference path="../../../node_modules/@types/jasmine/index.d.ts"/>
// Now works!

describe('Service: Auth', () => {

});

Question: Any idea why my types for Jasmine are not being visually referenced in WebStorm?

Upvotes: 1

Views: 979

Answers (1)

Ekaterina Prigara
Ekaterina Prigara

Reputation: 4957

WebStorm does not support tsconfig.spec.json. All the TypeScript options should be described in the file named tsconfig.json. Please follow this related issue for updates: https://youtrack.jetbrains.com/issue/WEB-28091

Upvotes: 4

Related Questions