Skip to content

Commit

Permalink
Add Event Types
Browse files Browse the repository at this point in the history
this makes addEventListener on GPUDevice have the right type
information.
  • Loading branch information
greggman committed Jan 29, 2025
1 parent 8faeb6d commit b9454c7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions dist/main.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import './index.d.ts';

declare global {

interface GPUDeviceEventMap {
"uncapturederror": GPUUncapturedErrorEvent;
}

interface GPUDevice {
addEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof GPUDeviceEventMap>(type: K, listener: (this: GPUDevice, ev: GPUDeviceEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
}

}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"bugs": "https://github.com/gpuweb/types/issues",
"version": "0.1.53",
"main": "",
"types": "dist/index.d.ts",
"types": "dist/main.d.ts",
"license": "BSD-3-Clause",
"files": [
"dist/**/*"
Expand Down

0 comments on commit b9454c7

Please sign in to comment.