Skip to content

Commit 804f296

Browse files
authored
fix: add GamepadEventHandler type (#9864)
Add GamepadEventHandler type for window.addEventListener `gamepadconnected` and `gamepaddisconnected`
1 parent b1795a8 commit 804f296

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.changeset/fair-eagles-wink.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: add `gamepadconnected` and `gamepaddisconnected` events

packages/svelte/elements.d.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export type KeyboardEventHandler<T extends EventTarget> = EventHandler<KeyboardE
5353
export type MouseEventHandler<T extends EventTarget> = EventHandler<MouseEvent, T>;
5454
export type TouchEventHandler<T extends EventTarget> = EventHandler<TouchEvent, T>;
5555
export type PointerEventHandler<T extends EventTarget> = EventHandler<PointerEvent, T>;
56+
export type GamepadEventHandler<T extends EventTarget> = EventHandler<GamepadEvent, T>;
5657
export type UIEventHandler<T extends EventTarget> = EventHandler<UIEvent, T>;
5758
export type WheelEventHandler<T extends EventTarget> = EventHandler<WheelEvent, T>;
5859
export type AnimationEventHandler<T extends EventTarget> = EventHandler<AnimationEvent, T>;
@@ -170,6 +171,10 @@ export interface DOMAttributes<T extends EventTarget> {
170171
'on:pointerup'?: PointerEventHandler<T> | undefined | null;
171172
'on:lostpointercapture'?: PointerEventHandler<T> | undefined | null;
172173

174+
// Gamepad Events
175+
'on:gamepadconnected'?: GamepadEventHandler<T> | undefined | null;
176+
'on:gamepaddisconnected'?: GamepadEventHandler<T> | undefined | null;
177+
173178
// UI Events
174179
'on:scroll'?: UIEventHandler<T> | undefined | null;
175180
'on:resize'?: UIEventHandler<T> | undefined | null;
@@ -1454,7 +1459,7 @@ export interface SVGAttributes<T extends EventTarget> extends AriaAttributes, DO
14541459
z?: number | string | undefined | null;
14551460
zoomAndPan?: string | undefined | null;
14561461

1457-
// allow any data- attribute
1462+
// allow any data- attribute
14581463
[key: `data-${string}`]: any;
14591464
}
14601465

0 commit comments

Comments
 (0)