fix: proper typings for unhandledrejection event (#15271)

This commit is contained in:
Bartek Iwańczuk 2022-07-21 23:54:53 +02:00 committed by GitHub
parent b5eb154d74
commit 4e71a9424e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 8 deletions

View file

@ -9,6 +9,7 @@
interface WindowEventMap {
"error": ErrorEvent;
"unhandledrejection": PromiseRejectionEvent;
}
declare class Window extends EventTarget {
@ -18,6 +19,9 @@ declare class Window extends EventTarget {
onerror: ((this: Window, ev: ErrorEvent) => any) | null;
onload: ((this: Window, ev: Event) => any) | null;
onunload: ((this: Window, ev: Event) => any) | null;
onunhandledrejection:
| ((this: Window, ev: PromiseRejectionEvent) => any)
| null;
close: () => void;
readonly closed: boolean;
alert: (message?: string) => void;
@ -64,6 +68,9 @@ declare var self: Window & typeof globalThis;
declare var onerror: ((this: Window, ev: ErrorEvent) => any) | null;
declare var onload: ((this: Window, ev: Event) => any) | null;
declare var onunload: ((this: Window, ev: Event) => any) | null;
declare var onunhandledrejection:
| ((this: Window, ev: PromiseRejectionEvent) => any)
| null;
declare var localStorage: Storage;
declare var sessionStorage: Storage;