Skip to content

Commit

Permalink
fix(workers): export missing types from definitions (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav authored Sep 4, 2024
2 parents 85701a7 + a4bb701 commit c836b59
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-buckets-visit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solid-primitives/workers": minor
---

fix(workers): export missing types from definitions
4 changes: 3 additions & 1 deletion packages/workers/src/index.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 5 additions & 5 deletions packages/workers/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
declare type WorkerSignal = number;
export type WorkerSignal = number;

declare type WorkerCallbacks = Map<string, [succes: Function, error: Function]>;
export type WorkerCallbacks = Map<string, [succes: Function, error: Function]>;

declare type WorkerMessage = {
export type WorkerMessage = {
type: WorkerSignal;
id?: string;
error?: string;
Expand All @@ -12,13 +12,13 @@ declare type WorkerMessage = {
params?: any;
};

declare type WorkerExports = [
export type WorkerExports = [
worker: Worker,
start: () => void,
stop: () => void,
exports?: Set<string>,
];

declare interface PostMessageOptions {
export interface PostMessageOptions {
transfer?: any[] | undefined;
}
2 changes: 2 additions & 0 deletions packages/workers/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { WorkerSignal, WorkerCallbacks, WorkerMessage } from "./types.js";

export const KILL: WorkerSignal = 0;
export const RPC: WorkerSignal = 1;

Expand Down

0 comments on commit c836b59

Please sign in to comment.