Fixed Typescript error when CustomEvents with non-object details are registered

pull/1183/head
Matt Pharoah 2023-02-08 17:55:28 -05:00
rodzic 15a4049a01
commit e65b09fdec
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -3,7 +3,7 @@ import { property } from 'lit/decorators.js';
type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
type SlEventInit<T> = T extends keyof GlobalEventHandlersEventMap
? GlobalEventHandlersEventMap[T] extends CustomEvent
? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<string, unknown>>
? GlobalEventHandlersEventMap[T] extends CustomEvent<Record<string, never>>
? CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>
: WithRequired<CustomEventInit<GlobalEventHandlersEventMap[T]['detail']>, 'detail'>