Skip to content

Commit

Permalink
Register event types for better type inference
Browse files Browse the repository at this point in the history
This allows typescript to know which kind of event object is passed to listeners for those event names.
  • Loading branch information
stof authored Mar 12, 2024
1 parent ff00f5b commit 75d656a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/tab-container-element-define.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ declare global {
['tab-container']: JSXBase['span'] & Partial<Omit<TabContainerElement, keyof HTMLElement>>
}
}
interface GlobalEventHandlersEventMap {
'tab-container-change': TabContainerChangeEvent;
'tab-container-changed': TabContainerChangeEvent;
}
interface ElementEventMap {
'tab-container-change': TabContainerChangeEvent;
'tab-container-changed': TabContainerChangeEvent;
}
}

export default TabContainerElement
Expand Down

0 comments on commit 75d656a

Please sign in to comment.