Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MediaQueryListEvent is an unknown type #3836

Open
GlennKnight opened this issue Jun 20, 2021 · 2 comments
Open

MediaQueryListEvent is an unknown type #3836

GlennKnight opened this issue Jun 20, 2021 · 2 comments
Assignees
Labels
triage-done Has been reviewed by someone on triage rotation.

Comments

@GlennKnight
Copy link

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.

@rishipal
Copy link
Contributor

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?

@rishipal rishipal added the triage-done Has been reviewed by someone on triage rotation. label Jun 22, 2021
@rishipal rishipal self-assigned this Jun 22, 2021
@GlennKnight
Copy link
Author

GlennKnight commented Jun 23, 2021

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'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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-done Has been reviewed by someone on triage rotation.
Projects
None yet
Development

No branches or pull requests

2 participants