Skip to content

Commit 15d015a

Browse files
committed
Adjusting export detail to fix linting
1 parent 31c158b commit 15d015a

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

packages/sse/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export {
66
type SSEReconnectOptions,
77
type SSESourceHandle,
88
type SSESourceFn,
9-
type SSEReadyState,
9+
type SSEReadyStateValue,
1010
type CreateSSEOptions,
1111
type SSEReturn,
1212
} from "./sse.js";

packages/sse/src/sse.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

packages/sse/src/worker-handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* This file has no Solid reactive code — it is safe to run in any Worker context.
1515
*/
16-
import { makeSSE, SSEReadyState } from "./sse.js";
16+
import { makeSSE, SSEReadyState, type SSEReadyStateValue } from "./sse.js";
1717
import type { SSEWorkerMessage } from "./worker.js";
1818

1919
const connections = new Map<string, VoidFunction>();
@@ -36,7 +36,7 @@ function handleMessage(data: SSEWorkerMessage, postBack: (msg: SSEWorkerMessage)
3636
postBack({
3737
type: "error",
3838
id,
39-
readyState: (ev.target as EventSource).readyState as SSEReadyState,
39+
readyState: (ev.target as EventSource).readyState as SSEReadyStateValue,
4040
}),
4141
events: Object.fromEntries(
4242
(events ?? []).map(name => [

packages/sse/src/worker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SSEReadyState, type SSEOptions, type SSESourceFn } from "./sse.js";
1+
import { SSEReadyState, type SSEReadyStateValue, type SSEOptions, type SSESourceFn } from "./sse.js";
22

33
// ─── Protocol types ───────────────────────────────────────────────────────────
44

@@ -12,7 +12,7 @@ export type SSEWorkerMessage =
1212
| { type: "disconnect"; id: string }
1313
| { type: "open"; id: string }
1414
| { type: "message"; id: string; data: string; eventType: string }
15-
| { type: "error"; id: string; readyState: SSEReadyState };
15+
| { type: "error"; id: string; readyState: SSEReadyStateValue };
1616

1717
/** A `Worker` or a `SharedWorker.port` — anything with `postMessage` and `addEventListener`. */
1818
export type SSEWorkerTarget = {
@@ -28,9 +28,9 @@ export type SSEWorkerTarget = {
2828
* Not exported — consumers use `makeSSEWorker` to obtain instances.
2929
*/
3030
class WorkerEventSource extends EventTarget {
31-
private _readyState: SSEReadyState = SSEReadyState.CONNECTING;
31+
private _readyState: SSEReadyStateValue = SSEReadyState.CONNECTING;
3232

33-
get readyState(): SSEReadyState {
33+
get readyState(): SSEReadyStateValue {
3434
return this._readyState;
3535
}
3636

packages/sse/test/setup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SSEReadyState } from "../src/sse.js";
1+
import { SSEReadyState, type SSEReadyStateValue } from "../src/sse.js";
22

33
declare global {
44
var SSEInstances: MockEventSource[];
@@ -14,7 +14,7 @@ export class MockEventSource extends EventTarget {
1414
readonly OPEN = SSEReadyState.OPEN;
1515
readonly CLOSED = SSEReadyState.CLOSED;
1616

17-
readyState: SSEReadyState = SSEReadyState.CONNECTING;
17+
readyState: SSEReadyStateValue = SSEReadyState.CONNECTING;
1818
withCredentials: boolean;
1919
url: string;
2020

0 commit comments

Comments
 (0)