WebStorm没有';t使用tsconfig编译器选项(Angular应用程序)
我有一个由WebStorm没有';t使用tsconfig编译器选项(Angular应用程序),angular,typescript,webstorm,tsconfig,Angular,Typescript,Webstorm,Tsconfig,我有一个由angularcli生成的默认项目结构,其中有一个根tsconfig.json,src/tsconfig.app.json和src/tsconfig.spec.json。虽然我在根配置中启用了noImplicitAny和strict选项,但当我不指定函数参数类型或将number类型化变量分配给null时,我的编辑器中不会出现错误扭曲 如何配置WebStorm以使用我的roottsconfig.json为我提供提示 这是我的roottsconfig.json: { "compileOnS
angularcli
生成的默认项目结构,其中有一个根tsconfig.json
,src/tsconfig.app.json
和src/tsconfig.spec.json
。虽然我在根配置中启用了noImplicitAny
和strict
选项,但当我不指定函数参数类型或将number
类型化变量分配给null
时,我的编辑器中不会出现错误扭曲
如何配置WebStorm以使用我的roottsconfig.json
为我提供提示
这是我的roottsconfig.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
}
}
My TypeScript WebStorm设置:
即使我在
tsconfig.json
中指定“文件”
和“包含”
选项以指向我的*.ts
文件,也不会出现错误,尽管在我以前的(非角度)应用程序中一切正常。如果我在我的项目根目录中运行tsc
,我会收到一堆预期的错误消息,但仍然没有提供编辑器提示。我通过选择“Angular language service”
解决了这个问题,因为我在TypeScript控制台中不断收到错误消息:
错误:初始化错误(angular 2语言服务)。无法读取未定义的属性“CommandTypes”
上面写着2018.3版的“已修复”。