Skip to content

Commit

Permalink
fix(client-event-bus): useEventBus accepts null event bus
Browse files Browse the repository at this point in the history
fixes #292
  • Loading branch information
Heymdall committed Dec 11, 2024
1 parent 133686a commit 1157100
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/warm-cycles-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@alfalab/client-event-bus': patch
---

Исправлен тип для useEventBusValue, теперь он принимает то, что возвращает getEventBus без приведения типов
2 changes: 1 addition & 1 deletion packages/client-event-bus/src/use-event-bus-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function useEventBusValue<
EventTypes extends AbstractKnownEventTypes,
Event extends keyof EventTypes,
>(
eventBus: AbstractAppEventBus<EventTypes> | undefined,
eventBus: AbstractAppEventBus<EventTypes> | undefined | null,
eventName: Event,
): EventTypes[Event] | undefined {
const [lastValue, setLastValue] = useState(eventBus?.getLastEventDetail?.(eventName));
Expand Down

0 comments on commit 1157100

Please sign in to comment.