my project has tsx and ts files, but I want to disable ts in test files

Viewed 274

I want to disable TS in my test files. The test files extension are of .test.tsx. I tried disabling TS check, but despite the code below, TS still complains.

"exclude": ["**/*.test.tsx", "**/*.test.ts"]

Does anyone know how to successfully disable TS in test.tsx? Is it wrong to use .tsx extension on files that I don't want to be checked by TS?

When I changed the extension to .js everything works as expected, but it's odd to suddenly introduce .js when every other file is ts related.

tsconfi.gjson

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",
    "types": [
      "node",
      "@testing-library/jest-dom",
    ]
  },
  "include": ["src"],
  "exclude": ["**/*.test.tsx", "**/*.test.ts"]
}
0 Answers
Related