【发布时间】:2018-10-27 21:17:07
【问题描述】:
我有一个由angular-cli 生成的默认项目结构,其中有一个根tsconfig.json、src/tsconfig.app.json 和src/tsconfig.spec.json。虽然我在根配置中打开了noImplicitAny 和strict 选项,但当我没有指定函数参数类型或将number 类型变量分配给null 时,我的编辑器中没有出现错误曲线。
如何配置 WebStorm 以使用我的根 tsconfig.json 为我提供提示?
这是我的根tsconfig.json:
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"target": "esnext",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom",
"esnext"
],
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true,
"strictNullChecks": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
}
}
我的 TypeScript WebStorm 设置:
即使我在tsconfig.json 中指定"files" 和"include" 选项以指向我的*.ts 文件,也不会出现错误,尽管在我以前的(非角度)应用程序中一切正常。如果我在项目根目录中运行 tsc,我会收到一堆预期的错误消息,但仍然没有提供编辑器提示。
【问题讨论】:
标签: angular typescript webstorm tsconfig