google/closure-compiler

Unknown type 'BeforeUnloadEvent'

Open

#3 987 ouverte le 16 août 2022

Voir sur GitHub
 (3 commentaires) (0 réactions) (0 assignés)Java (1 197 forks)batch import
help wanted

Métriques du dépôt

Stars
 (7 176 stars)
Métriques de merge PR
 (Merge moyen 3j 4h) (1 PR mergée en 30 j)

Description

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?

Guide contributeur