diff --git a/types/events.d.ts b/types/events.d.ts index a4c144cdd..265411844 100644 --- a/types/events.d.ts +++ b/types/events.d.ts @@ -5,8 +5,16 @@ type CustomEventMap = { }; declare global { interface Window { - addEventListener(type: T, listener: (e: CustomEventMap[T]) => void): void; - removeEventListener(type: T, listener: (e: CustomEventMap[T]) => void): void; + addEventListener( + type: T, + listener: (e: CustomEventMap[T]) => void, + options?: boolean | AddEventListenerOptions + ): void; + removeEventListener( + type: T, + listener: (e: CustomEventMap[T]) => void, + options?: boolean | EventListenerOptions + ): void; } } diff --git a/types/test/events.test-d.ts b/types/test/events.test-d.ts index e81b565c2..5b269b9c1 100644 --- a/types/test/events.test-d.ts +++ b/types/test/events.test-d.ts @@ -4,10 +4,12 @@ import type { EventPayload, UploadCtxProvider } from '../..'; window.addEventListener('LR_DATA_OUTPUT', (e) => { expectType>(e); -}); +}, { once: true }); const ctx: UploadCtxProvider = null as unknown as UploadCtxProvider; - -ctx.addEventListener('data-output', (e) => { - expectType>(e); -}); +ctx.addEventListener( + 'data-output', + (e) => { + expectType>(e); + } +);