{
"compilerOptions" : {
"target": "ES3",
"module": "ES2015",
"declaration": false,
"sourceMap": true,
"outDir": "./dist",
"rootDir": "./src",
"watch": true
},
"include": [
"src/**/*"
]
}
您需要在 tsconfig.json 中添加
noEmitOnError: true
。
此标志控制如果报告任何错误,打字稿编译器是否应生成输出文件。默认情况下它是 false,这意味着即使存在错误,编译器仍然会发出输出文件。
我也有同样的问题。 我在
tsconfig
属性之后删除了 compilerOptions
中的 src。然后 tsc
命令开始显示类型错误和导入。
将它们附加到 config.json 中,而不是在每次导入后添加扩展(ts)。
{
"noEmit": true,
"allowImportingTsExtensions": true
}