@@ -22,7 +22,7 @@ export const SSEReadyState = {
2222} as const ;
2323
2424/** The numeric type of a valid SSE ready-state value (`0 | 1 | 2`). */
25- export type SSEReadyState = ( typeof SSEReadyState ) [ keyof typeof SSEReadyState ] ;
25+ export type SSEReadyStateValue = ( typeof SSEReadyState ) [ keyof typeof SSEReadyState ] ;
2626
2727// ─── Types ────────────────────────────────────────────────────────────────────
2828
@@ -108,7 +108,7 @@ export type SSEReturn<T> = {
108108 * - `SSEReadyState.OPEN` (1)
109109 * - `SSEReadyState.CLOSED` (2)
110110 */
111- readyState : Accessor < SSEReadyState > ;
111+ readyState : Accessor < SSEReadyStateValue > ;
112112 /** Close the connection. */
113113 close : VoidFunction ;
114114 /** Force-close the current connection and open a new one. */
@@ -204,7 +204,7 @@ export const createSSE = <T = string>(
204204 const [ source , setSource ] = createSignal < SSESourceHandle | undefined > ( undefined ) ;
205205 const [ data , setData ] = createSignal < T | undefined > ( options . initialValue ) ;
206206 const [ error , setError ] = createSignal < Event | undefined > ( undefined ) ;
207- const [ readyState , setReadyState ] = createSignal < SSEReadyState > ( SSEReadyState . CONNECTING ) ;
207+ const [ readyState , setReadyState ] = createSignal < SSEReadyStateValue > ( SSEReadyState . CONNECTING ) ;
208208
209209 // ── Reconnect config ──────────────────────────────────────────────────────
210210 const reconnectConfig : SSEReconnectOptions =
@@ -251,7 +251,7 @@ export const createSSE = <T = string>(
251251
252252 const handleError = ( e : Event ) => {
253253 const es = e . target as SSESourceHandle ;
254- setReadyState ( es . readyState as SSEReadyState ) ;
254+ setReadyState ( es . readyState as SSEReadyStateValue ) ;
255255 setError ( ( ) => e ) ;
256256 options . onError ?.( e ) ;
257257
@@ -273,7 +273,7 @@ export const createSSE = <T = string>(
273273 } ) ;
274274
275275 setSource ( ( ) => es ) ;
276- setReadyState ( es . readyState as SSEReadyState ) ;
276+ setReadyState ( es . readyState as SSEReadyStateValue ) ;
277277 currentCleanup = cleanup ;
278278 } ;
279279
0 commit comments