diff --git a/.changeset/short-buckets-visit.md b/.changeset/short-buckets-visit.md new file mode 100644 index 000000000..e43083d36 --- /dev/null +++ b/.changeset/short-buckets-visit.md @@ -0,0 +1,5 @@ +--- +"@solid-primitives/workers": minor +--- + +fix(workers): export missing types from definitions diff --git a/packages/workers/src/index.ts b/packages/workers/src/index.ts index 21f937d0b..8f208ecef 100644 --- a/packages/workers/src/index.ts +++ b/packages/workers/src/index.ts @@ -1,7 +1,9 @@ import { Accessor, Setter, createEffect, on, onCleanup } from "solid-js"; import { isServer } from "solid-js/web"; +import type { PostMessageOptions, WorkerCallbacks, WorkerExports, WorkerMessage } from "./types.js"; +import { KILL, RPC, cjs, setup } from "./utils.js"; -import { cjs, setup, KILL, RPC } from "./utils.js"; +export type * from "./types.js"; /** * Creates a very basic WebWorker based on provided code. diff --git a/packages/workers/src/types.d.ts b/packages/workers/src/types.d.ts index c2f8c3905..b33c4efa0 100644 --- a/packages/workers/src/types.d.ts +++ b/packages/workers/src/types.d.ts @@ -1,8 +1,8 @@ -declare type WorkerSignal = number; +export type WorkerSignal = number; -declare type WorkerCallbacks = Map; +export type WorkerCallbacks = Map; -declare type WorkerMessage = { +export type WorkerMessage = { type: WorkerSignal; id?: string; error?: string; @@ -12,13 +12,13 @@ declare type WorkerMessage = { params?: any; }; -declare type WorkerExports = [ +export type WorkerExports = [ worker: Worker, start: () => void, stop: () => void, exports?: Set, ]; -declare interface PostMessageOptions { +export interface PostMessageOptions { transfer?: any[] | undefined; } diff --git a/packages/workers/src/utils.ts b/packages/workers/src/utils.ts index edf40deb1..fccb9d65f 100644 --- a/packages/workers/src/utils.ts +++ b/packages/workers/src/utils.ts @@ -1,3 +1,5 @@ +import type { WorkerSignal, WorkerCallbacks, WorkerMessage } from "./types.js"; + export const KILL: WorkerSignal = 0; export const RPC: WorkerSignal = 1;