fix(cli): update type definitions to align to TS dom
Fixes
@@ -646,6 +646,15 @@ interface ProgressEventInit extends EventInit {
total?: number;
}
+interface AbstractWorkerEventMap {
+ "error": ErrorEvent;
+}
+
+interface WorkerEventMap extends AbstractWorkerEventMap {
+ "message": MessageEvent;
+ "messageerror": MessageEvent;
+}
+
declare class Worker extends EventTarget {
onerror?: (e: ErrorEvent) => void;
onmessage?: (e: MessageEvent) => void;
@@ -705,6 +714,26 @@ declare class Worker extends EventTarget {
);
postMessage(message: any, transfer: ArrayBuffer[]): void;
postMessage(message: any, options?: PostMessageOptions): void;
+ addEventListener<K extends keyof WorkerEventMap>(
+ type: K,
+ listener: (this: Worker, ev: WorkerEventMap[K]) => any,
+ options?: boolean | AddEventListenerOptions,
+ ): void;
+ addEventListener(
+ type: string,
+ listener: EventListenerOrEventListenerObject,
+ options?: boolean | AddEventListenerOptions,
+ ): void;
+ removeEventListener<K extends keyof WorkerEventMap>(
+ type: K,
+ listener: (this: Worker, ev: WorkerEventMap[K]) => any,
+ options?: boolean | EventListenerOptions,
+ ): void;
+ removeEventListener(
+ type: string,
+ listener: EventListenerOrEventListenerObject,
+ options?: boolean | EventListenerOptions,
+ ): void;
terminate(): void;
}
