Skip to content

Unknown type 'BeforeUnloadEvent' #3987

Open
@supahero1

Description

@supahero1

test.js:

/** @type {BeforeUnloadEvent} */
var a;

Compiled with closure-compiler -O ADVANCED --js test.js --js_output_file test.min.js version v20220601:

test.js:1:11: WARNING - [JSC_UNRECOGNIZED_TYPE_ERROR] Bad type annotation. Unknown type BeforeUnloadEvent
  1| /** @type {BeforeUnloadEvent} */
                ^

0 error(s), 1 warning(s)

That's strange, since the following executed in the browser:

onbeforeunload = function(e) {
    console.log(e);
    e.preventDefault();
    return "";
};

returns BeforeUnloadEvent in the console. Why does GCC not support it?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions