Skip to content

Commit

Permalink
Merge pull request DefinitelyTyped#33025 from thegecko/master
Browse files Browse the repository at this point in the history
[w3c-web-usb] Include addEventListener overload to fix strict TypeScript
  • Loading branch information
minestarks authored Feb 13, 2019
2 parents f957319 + 713c0d0 commit 5297cb6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions types/w3c-web-usb/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Type definitions for W3C Web USB API 1.0
// Project: https://wicg.github.io/webusb/
// Definitions by: Lars Knudsen <https://github.com/larsgk>
// Rob Moran <https://github.com/thegecko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
// TypeScript Version: 2.3

type USBDirection = "in" | "out";
type USBEndpointType = "bulk" | "interrupt" | "isochronous";
Expand Down Expand Up @@ -111,8 +112,8 @@ declare class USB extends EventTarget {
ondisconnect(): (this: this, ev: Event) => any;
getDevices(): Promise<USBDevice[]>;
requestDevice(options?: USBDeviceRequestOptions): Promise<USBDevice>;

addEventListener(type: "connect" | "disconnect", listener: (this: this, ev: USBConnectionEvent) => any, useCapture?: boolean): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions): void;
}

declare class USBDevice {
Expand Down
4 changes: 2 additions & 2 deletions types/w3c-web-usb/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
Expand All @@ -21,4 +21,4 @@
"index.d.ts",
"w3c-web-usb-tests.ts"
]
}
}

0 comments on commit 5297cb6

Please sign in to comment.