简体   繁体   English

VS Code和Typescript监视:正在重新编译文件而不保存文件

[英]VS Code and Typescript watch: Files are being recompiled without being saved

I'm developing a Typescript project and I run "tsc -w" to keep it compiling while I edit. 我正在开发一个Typescript项目,并运行“ tsc -w”以使其在编辑时保持编译状态。

The problem is, sometimes my files will be recompiled even when I don't save them. 问题是,即使我不保存文件,有时也会重新编译我的文件。 Sometimes it recompiles files randomly that I haven't touched (Like if I open an existing file in typescript to begin editing) 有时它会随机重新编译我没有碰过的文件(例如,如果我在打字稿中打开现有文件开始编辑)

Is this vs code? 这是代码吗? or Typescript? 还是打字稿? does anyone know a solution to stop this happening? 有谁知道阻止这种情况发生的解决方案?

My .tsconfig is below 我的.tsconfig在下面

{
  "compilerOptions": {
    "target": "es2015",
    "module": "es2015",
    "allowJs": false,
    "jsx": "react",
    "sourceMap": true,
    "outDir": "build",

    "baseUrl": ".",
    "paths": {
      "@shared/*": [ "src/shared/*" ],
      "@app/*": ["src/*"]
    },
    "strict": true,
    "moduleResolution": "node",
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
  },
  "filesGlob": [
    "src/**/*.ts",
    "src/**/*.tsx",
  ],
  "types": [
    "react",
    "react-dom",
    "react-native"
  ],
  "exclude": [
    "build",
    "**/node_modules/*",
    "jest.config.js",
    "App.js"
  ],
  "include": [
    "./src",
  ],
  "compileOnSave": false
}

Turns out I didn't have to run a separate Typescript Watch process - Expo Typescript support has improved since I started my project. 原来,我不必运行单独的Typescript监视过程-自从我开始项目以来,Expo Typescript的支持得到了改善。

See https://docs.expo.io/versions/latest/guides/typescript/ 参见https://docs.expo.io/versions/latest/guides/typescript/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM