Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a969e25

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

File tree

1 file changed

+2
-2
lines changed
Filter options

1 file changed

+2
-2
lines changed

‎packages/core/useEventSource/index.ts

Copy file name to clipboardExpand all lines: packages/core/useEventSource/index.ts
+2-2
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.