djangofan
djangofan

Reputation: 29669

My Angular tsconfig does not detect my Cypress types

My Angular tsconfig does not detect my Cypress 12.3 types. I've tried all kinds of things to get this working, short of starting my Cypress project over (which I suspect would work).

My code runs fine but I cannot resolve this situation pictured here in my IDE:

enter image description here

At the moment, my cypress/tsconfig.json looks like this:

{
  "extends": "../tsconfig.spec.json",
  "files": [
    "../cypress/**/*.ts",
    "../cypress.config.ts",
    "../node_modules/cypress"
  ],
  "compilerOptions": {
    "sourceMap": false,
    "types": ["cypress", "node", "jasmine-expect", "chai"]
  }
}

The above config is trying to prefer jasmine expect type over chai expect, which I REQUIRE.

Upvotes: 2

Views: 876

Answers (1)

djangofan
djangofan

Reputation: 29669

Ok, I found the solution. Must be careful about using files rather than include/exclude:

{
  "extends": "../tsconfig.spec.json",
  "include": [
    "**/*.ts",
    "../cypress.config.ts",
    "../node_modules/cypress"
  ],
  "exclude": [
    "../src/**/*.ts"
  ],
  "compilerOptions": {
    "sourceMap": false,
    "types": ["cypress", "node", "jasmine-expect"]
  }
}

Upvotes: 1

Related Questions