dimanche 1 février 2015

How to inform WebStorm's autocomplete about WebGLRenderingContext


I'm working on a project involving WebGL, and using WebStorm to do the development.


One issue with the development flow is that WebStorm isn't about to autocomplete things related to WebGL. In particular, if I annotate a value as being of type WebGLRenderingContext



/** @type {!WebGLRenderingContext} */
var gl;


WebStorm complains that WebGLRenderingContext is an unresolved variable. Also it complains about usages of methods on gl, warning that it can't find those methods so they may not exist.


My current workaround (besides just turning off the warnings) is to specify a record type like so:



* @type {{
* texParameteri: function,
* TEXTURE_WRAP_T: *,
* ...
* }}


But obviously it's a bit silly to be listing dozens and dozens of members like this. Is there an easier way?





Aucun commentaire:

Enregistrer un commentaire