I have a project which includes library.js
and mycode.js
. My code includes
let x = new LibraryObject ();
I tried running mycode.js
through Google Closure which complains
ERROR - variable LibraryObject is undeclared
when the -W VERBOSE
flag is given.
I could concatenate the two files into libraryandmycode.js
but I want to keep them separate because reasons. I tried declaring LibraryObject
in mycode.js
but then I get an "illegal redeclared variable" error.
Without modifying library.js
, can I add something to mycode.js
which will establish that LibraryObject
exists, but without redeclaring it?
This causes no problems in the browser but I want validation to pass for each file separately as well as when they're taken together.
The criteria is that no errors are produced under strict interpretation whether either of the two scripts are parsed individually, or when both are taken together.
Is this possible?