WebStorm: Initializer type <TYPE> is not assignable to variable type <LIBRARY>.<TYPE>

醉酒当歌 提交于 2021-01-29 16:19:24

问题


I have a Vue.js project without TypeScript.

If I import some library with the * as syntax, the autocomplete / suggestions do not work.

import * as THREE from 'three';
const scene = new THREE.Scene();

WebStorm complains saying

Initializer type Scene is not assignable to variable type THREE.Scene

Of course at runtime there are no errors.

What can I do to teach WebStorm to correctly assign the variable type?


回答1:


It's fixed in 2019.1 (coming this quarter):

checked in WS-191.3749 (internal build, not published anywhere)



来源:https://stackoverflow.com/questions/54238584/webstorm-initializer-type-type-is-not-assignable-to-variable-type-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!