Skip to content

Commit a969e25

Browse files
authored
fix(useEventSource): add missing data generic (#4726)
1 parent 65a99c4 commit a969e25

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/core/useEventSource/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export interface UseEventSourceReturn<Events extends string[], Data = any> {
5555
* Reference to the latest data received via the EventSource,
5656
* can be watched to respond to incoming messages
5757
*/
58-
data: ShallowRef<Data>
58+
data: ShallowRef<Data | null>
5959

6060
/**
6161
* The current state of the connection, can be only one of:
@@ -114,7 +114,7 @@ export function useEventSource<Events extends string[], Data = any>(
114114
url: MaybeRefOrGetter<string | URL | undefined>,
115115
events: Events = [] as unknown as Events,
116116
options: UseEventSourceOptions = {},
117-
): UseEventSourceReturn<Events> {
117+
): UseEventSourceReturn<Events, Data> {
118118
const event: ShallowRef<string | null> = shallowRef(null)
119119
const data: ShallowRef<Data | null> = shallowRef(null)
120120
const status = shallowRef<EventSourceStatus>('CONNECTING')

0 commit comments

Comments
 (0)