contrib/externs/jquery-1.9.js not accepted
Hi, I'm just taking these rules for a spin. I know they say alpha, so if the issues aren't helpful, feel free to tell me to hold off for a bit.
This issue is about using jquery externs in the js build.
BUILD
closure_js_binary(
name = "coffeerun_bin",
main = "coffeerun",
deps = [":coffeerun_lib"],
)
closure_js_library(
name = "coffeerun_lib",
srcs = glob(["scripts/*.js"]),
deps = [
"@io_bazel_rules_closure//closure/library",
":coffeerun_soy",
":jquery",
]
)
closure_js_library(
name = "jquery",
externs = ["externs/jquery-1.9.js"],
)
Referencing this file: https://github.com/google/closure-compiler/blob/master/contrib/externs/jquery-1.9.js
Fails with this error:
externs/jquery-1.9.js:160: ERROR - All constants must be typed. The compiler could not infer the type of this constant. Please use an explicit type annotation.
var $ = jQuery;
^
1 error(s), 0 warning(s)
Additionally, I successfully use this externs file in my normal build. Is it intentional that it's more strict, or is there a way to disable that extra strictness?
Thanks!
Adding the type does fix this issue, so maybe that's the solution
/**
* @const
* @type {jQuery}
*/
var $ = jQuery;
I think this is caused by https://github.com/google/closure-compiler/issues/1725. Hopefully it will be resolved by the next compiler release.