问题
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