closure-compiler
closure-compiler copied to clipboard
MediaQueryListEvent is an unknown type
I'm getting the following error when trying to use the MediaQueryListEvent type:
WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type MediaQueryListEvent
Code:
/**
* Handle MediaQueryList change event
* @param {MediaQueryListEvent} ev
*/
handleChange(ev) {
...
}
The code passes type checking in VSCode and 'Go to Definition' works.
I'm running "google-closure-compiler": "^20210601.0.0"
It looks like MediaQueryListEvent has been around for a while (https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryListEvent) so maybe it's just a missing extern?
I've tried suppressing the warning for now by adding @suppress {checkTypes}
, but that doesn't seem to work.
I think that the MediaQueryListEvent
should've been defined inside https://github.com/google/closure-compiler/blob/master/externs/browser/w3c_css.js
, but I see that it isn't. Were you able to check that adding it to w3c_css.js
fixes it?
I think that the
MediaQueryListEvent
should've been defined insidehttps://github.com/google/closure-compiler/blob/master/externs/browser/w3c_css.js
, but I see that it isn't. Were you able to check that adding it tow3c_css.js
fixes it?
I'm using the npm package instead of building it myself so I haven't been able to try adding a fix. Instead, I created my own local externs file to remove the error