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

1.2k views Asked by At

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

There are 1 answers

2
lena On BEST ANSWER

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

enter image description here

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