WebStorm不使用tsconfig编译器选项(Angular应用)

时间:2018-10-27 21:17:07

标签: angular typescript webstorm tsconfig

我有一个由export async function currentPosition() { const fetchResult = fetch('http://api.open-notify.org/iss-now.json'); const response = await fetchResult; const iss_position = await response.json(); } export function initMap() { let map = new google.maps.Map(document.getElementById('map'), { center: iss_position, zoom: 5, }); let marker = new google.maps.Marker({ position: iss_position, map: map, }); } currentPosition(); initMap(); 生成的默认项目结构,其中有一个根angular-clitsconfig.jsonsrc/tsconfig.app.json。尽管我在根配置中启用了src/tsconfig.spec.jsonnoImplicitAny选项,但是当我未指定函数参数类型或未将strict类型的变量分配给{{ 1}}。

如何配置WebStorm以使用我的根number为我提供提示?

这是我的根null

tsconfig.json

我的TypeScript WebStorm设置:

My WebStorm TypeScript settings

即使我在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 } } "files"选项以指向我的"include"文件,也不会出现错误,尽管在我以前的(非角度)应用程序中,工作良好。如果我在项目根目录中运行tsconfig.json,则会收到一堆预期的错误消息,但仍未提供编辑器提示。

1 个答案:

答案 0 :(得分:1)

由于设法在TypeScript控制台中不断收到错误消息,因此我选择了"Angular language service"来解决了这个问题: Error:Initialization error (angular 2 language service). Cannot read property 'CommandTypes' of undefined

This is a bug