Skip to content

Documentation / @hybrid-compute/worker / WorkerResultMessageInterface

Interface: WorkerResultMessageInterface<Output> ​

Defined in: packages/worker/src/types.ts:82

What the worker script sends back: the task's id with either a result or an error. An error (a message string, or an object with a message) rejects the task with a WorkerTaskError.

Example ​

ts
self.postMessage({ id: 1, result: 42 } satisfies WorkerResultMessageInterface);

Type Parameters ​

Output ​

Output = unknown

Properties ​

error? ​

ts
optional error?: unknown;

Defined in: packages/worker/src/types.ts:85


id ​

ts
id: number;

Defined in: packages/worker/src/types.ts:83


result? ​

ts
optional result?: Output;

Defined in: packages/worker/src/types.ts:84