我使用ts-node-dev来编译和运行我的节点应用程序。
ts-node-dev -r tsconfig-paths/register src/collectDayMatches.ts
但是ts-node-dev打印只是运行时错误(而不是ts错误)。
如果我在构建应用程序中使用tsc,我会得到预期的错误。
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/*"]
}
}
}发布于 2021-01-28 10:57:27
我也遇到了同样的问题,因为我将--transpile-only传递给ts-node-dev。当我删除--transpile-only时,正在打印TypeScript错误,并且编译中断。
忽略TypeScript错误:
ts-node-dev --respawn --transpile-only -r tsconfig-paths/register src/index.ts报告TypeScript错误:
ts-node-dev --respawn -r tsconfig-paths/register src/index.tshttps://stackoverflow.com/questions/61516059
复制相似问题