How To Have A Type In Closure Compiler Externs Without A Constructor
I am trying to make externs for the Google Closure Compiler for types that have no constructor. I have tried the following, but it gives me a Bad type annotation. Unknown type Wind
Solution 1:
The typical annotation for this pattern is:
/** @const */var WindowsMediaActiveX = {};
/**
* Methods and properties for accessing a CD or DVD in its drive.
* @constructor
* @private
*/
WindowsMediaActiveX.Cdrom=function(){};
The @private
annotation is the indication that the constructor is not meant to be directly called. However, the compiler will only report a warning on direct instantiations of the type when the accessControls warning group is enabled (on with VERBOSE warnings).
Edit: Answer updated to add the required @const
annotation to the namespace. The access control annotations will be ignored otherwise.
Post a Comment for "How To Have A Type In Closure Compiler Externs Without A Constructor"