简体   繁体   English

ts-node-dev 不打印 ts 错误

[英]ts-node-dev not printing ts errors

I use ts-node-dev for compile and run my node app.我使用ts-node-dev编译和运行我的节点应用程序。

ts-node-dev -r tsconfig-paths/register src/collectDayMatches.ts

But ts-node-dev printing just runtime errors (not ts errors).但是ts-node-dev只打印运行时错误(不是 ts 错误)。

if I use tsc for the build app, I get errors as expected.如果我将tsc用于构建应用程序,我会得到预期的错误。

tsconfig.json: tsconfig.json:

{
  "compilerOptions": {
    "target": "es2019",
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "dist",
    "strict": true,
    "inlineSourceMap": true,
    "noImplicitAny": true,
    "noImplicitReturns": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "allowJs": false,
    "lib": ["es2016", "esnext.asynciterable", "webworker"],
    "types": ["node"],
    "allowSyntheticDefaultImports": true,
    "strictPropertyInitialization": false,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "forceConsistentCasingInFileNames": true,
    "pretty": true,
    "baseUrl": "./src",
    "paths": {
      "utils/*": ["utils/*"]
    }
  }
}

I had the same problem because I was passing --transpile-only to ts-node-dev.我遇到了同样的问题,因为我将--transpile-only传递给 ts-node-dev。 When I removed --transpile-only , TypeScript errors were being printed and compile interrupted.当我删除--transpile-only时,正在打印 TypeScript 错误并中断编译。

Ignores TypeScript error:忽略 TypeScript 错误:

ts-node-dev --respawn --transpile-only -r tsconfig-paths/register src/index.ts

Reports TypeScript error:报告 TypeScript 错误:

ts-node-dev --respawn -r tsconfig-paths/register src/index.ts

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

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