diff --git a/types/w3c-web-usb/index.d.ts b/types/w3c-web-usb/index.d.ts index e56e8aab9b2dfb..883fa94436f513 100644 --- a/types/w3c-web-usb/index.d.ts +++ b/types/w3c-web-usb/index.d.ts @@ -109,7 +109,7 @@ declare class USB extends EventTarget { addEventListener( type: "connect" | "disconnect", listener: (this: this, ev: USBConnectionEvent) => any, - useCapture?: boolean, + options?: boolean | AddEventListenerOptions, ): void; addEventListener( type: string, @@ -119,7 +119,7 @@ declare class USB extends EventTarget { removeEventListener( type: "connect" | "disconnect", callback: (this: this, ev: USBConnectionEvent) => any, - useCapture?: boolean, + options?: EventListenerOptions | boolean, ): void; removeEventListener( type: string, diff --git a/types/w3c-web-usb/w3c-web-usb-tests.ts b/types/w3c-web-usb/w3c-web-usb-tests.ts index b7d780927e490c..8c5e06da7ea22f 100644 --- a/types/w3c-web-usb/w3c-web-usb-tests.ts +++ b/types/w3c-web-usb/w3c-web-usb-tests.ts @@ -45,6 +45,16 @@ navigator.usb.addEventListener("connect", evt => { // Add |device| to the UI. handleConnectedDevice(evt.device); }); +// `options: boolean` +navigator.usb.addEventListener("connect", evt => { + // Add |device| to the UI. + handleConnectedDevice(evt.device); +}, true); +// `options: AddEventListenerOptions` +navigator.usb.addEventListener("connect", evt => { + // Add |device| to the UI. + handleConnectedDevice(evt.device); +}, { capture: true }); navigator.usb.addEventListener("disconnect", evt => { // Remove |device| from the UI.