///
import { MessagePort } from 'node:worker_threads';
export type AnyFn = (...args: T) => R;
export type AnyPromise = Promise;
export type AnyAsyncFn = AnyFn>;
export type Syncify = T extends (...args: infer Args) => Promise ? (...args: Args) => R : never;
export type PromiseType = T extends Promise ? R : never;
export type ValueOf = T[keyof T];
export interface MainToWorkerMessage {
sharedBuffer: SharedArrayBuffer;
id: number;
args: T;
}
export interface WorkerData {
workerPort: MessagePort;
}
export interface DataMessage {
result?: T;
error?: unknown;
properties?: unknown;
}
export interface WorkerToMainMessage extends DataMessage {
id: number;
}