简体   繁体   English

React-native typescript 模板未编译 tsc、tsx 文件

[英]React-native typescript template not compiling tsc, tsx fles

I have created a new expo app with a blank (TypeScript) template, and create a script entry in a package JSON file like this.我创建了一个带有空白(TypeScript)模板的新 expo 应用程序,并像这样在 package JSON 文件中创建了一个脚本条目。

"compile-project":"tsc --watch"

but the project not compiling the any of tsc, tsx files in my project directory while running the "compile-project" command.但是在运行“compile-project”命令时,该项目没有编译我的项目目录中的任何 tsc、tsx 文件。

here is my tsconfg file这是我的 tsconfg 文件

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "jsx": "react-native",
    "lib": ["dom", "esnext"],
    "moduleResolution": "node",
    "noEmit": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "strict": true
  }
}

Looks like you're setting up to stop emit files by giving noEmit: true .看起来您正在设置通过提供noEmit: true来停止发出文件。 This option is only useful for checking the typing only.此选项仅对检查打字有用。

Try to switch it back to false to see the compiled files in the output:尝试将其切换回false以查看output中的编译文件:

tsconfig.json

{
  "compilerOptions": {
    // ...
    "noEmit": false,
  } 
}

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

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