Skip to content

Commit 22aa51d

Browse files
committed
allow optional parameters for createEventDispatcher
1 parent c17384b commit 22aa51d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/runtime/internal/lifecycle.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ type ExtractObjectValues<Object extends Record<any, any>> = Object[keyof Object]
3636
type ConstructDispatchFunction<EventMap extends Record<string, any>, EventKey extends keyof EventMap> =
3737
EventMap[EventKey] extends never
3838
? (type: EventKey) => void
39+
: undefined extends EventMap[EventKey]
40+
? (type: EventKey, detail?: EventMap[EventKey]) => void
3941
: (type: EventKey, detail: EventMap[EventKey]) => void
4042

4143
type CreateDispatchFunctionMap<EventMap> = {

0 commit comments

Comments
 (0)