From 804f29636872e928e3b5948df0ae800e3c581c99 Mon Sep 17 00:00:00 2001 From: Jirawat Boonkumnerd Date: Mon, 11 Dec 2023 15:50:32 +0700 Subject: [PATCH] fix: add GamepadEventHandler type (#9864) Add GamepadEventHandler type for window.addEventListener `gamepadconnected` and `gamepaddisconnected` --- .changeset/fair-eagles-wink.md | 5 +++++ packages/svelte/elements.d.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/fair-eagles-wink.md diff --git a/.changeset/fair-eagles-wink.md b/.changeset/fair-eagles-wink.md new file mode 100644 index 0000000000..10fbffb736 --- /dev/null +++ b/.changeset/fair-eagles-wink.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: add `gamepadconnected` and `gamepaddisconnected` events \ No newline at end of file diff --git a/packages/svelte/elements.d.ts b/packages/svelte/elements.d.ts index 2161f56da4..93949b59d7 100644 --- a/packages/svelte/elements.d.ts +++ b/packages/svelte/elements.d.ts @@ -53,6 +53,7 @@ export type KeyboardEventHandler = EventHandler = EventHandler; export type TouchEventHandler = EventHandler; export type PointerEventHandler = EventHandler; +export type GamepadEventHandler = EventHandler; export type UIEventHandler = EventHandler; export type WheelEventHandler = EventHandler; export type AnimationEventHandler = EventHandler; @@ -170,6 +171,10 @@ export interface DOMAttributes { 'on:pointerup'?: PointerEventHandler | undefined | null; 'on:lostpointercapture'?: PointerEventHandler | undefined | null; + // Gamepad Events + 'on:gamepadconnected'?: GamepadEventHandler | undefined | null; + 'on:gamepaddisconnected'?: GamepadEventHandler | undefined | null; + // UI Events 'on:scroll'?: UIEventHandler | undefined | null; 'on:resize'?: UIEventHandler | undefined | null; @@ -1454,7 +1459,7 @@ export interface SVGAttributes extends AriaAttributes, DO z?: number | string | undefined | null; zoomAndPan?: string | undefined | null; - // allow any data- attribute + // allow any data- attribute [key: `data-${string}`]: any; }