我的项目中有 src
和 test
文件夹。由于我不想编译我的测试文件,我在我的 tsconfig.json
文件中使用了 exclude
属性忽略了它们,但我注意到这也使 TypeScript 在测试期间停止验证我的文件是否正确编码,所以当我运行测试时我只会看到我的错误。是否可以让 TypeScript 在不编译的情况下验证我的代码?如果是,如何?如果不是,你有什么建议来解决我的问题?
如果有用,这是我的 tsconfig.json
文件:
{
"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
}
}