From 75d656a84b6ad7b7d9a8bd8e6a252c39702abaf3 Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Tue, 12 Mar 2024 18:58:08 +0100 Subject: [PATCH] Register event types for better type inference This allows typescript to know which kind of event object is passed to listeners for those event names. --- src/tab-container-element-define.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tab-container-element-define.ts b/src/tab-container-element-define.ts index 208ac57..95f1baa 100644 --- a/src/tab-container-element-define.ts +++ b/src/tab-container-element-define.ts @@ -27,6 +27,14 @@ declare global { ['tab-container']: JSXBase['span'] & Partial> } } + interface GlobalEventHandlersEventMap { + 'tab-container-change': TabContainerChangeEvent; + 'tab-container-changed': TabContainerChangeEvent; + } + interface ElementEventMap { + 'tab-container-change': TabContainerChangeEvent; + 'tab-container-changed': TabContainerChangeEvent; + } } export default TabContainerElement