2

I have the src and test folders in my project. Since I don't want to compile my test files, I have ignored them in my tsconfig.json file with the exclude property, but I noticed that this also made TypeScript stopping verifying if my files are correct during the coding, so then I just see my errors when I run the tests. Is it possible to make TypeScript verify my code without compiling it? If yes, how? And if no, what do you suggest to solve my problem?

If It's any useful, here's my tsconfig.json file:

{
  "exclude": ["node_modules", "test"],
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "sourceMap": true,
    "outDir": "./build",
    "noEmitOnError": true,
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  }
}
  • 1
    Does this answer your question: https://stackoverflow.com/questions/53856082/typescript-make-tsconfig-emit-one-folder-but-not-the-other-folder – jcalz Jul 19 '21 at 00:54
  • Why don’t you want to compile? – Ezra Jul 19 '21 at 01:24
  • @jcalz Yes, thank you! @Ezra Well, I use Jest for tests and It doesn't need `.js` files to run, since It understands TypeScript. Another reason is because, in my point of view, the `build` folder (where my compiled files are saved) should be a copy of the `src` but with the compiled files, and the `test` folder is out the `src` folder. But I don't now if this idea is correct (or if It is a good practice). – Nathan Murillo Jul 19 '21 at 01:39

0 Answers0