import { FunctionThread, ModuleThread, StripAsync, Worker as WorkerType } from "../types/master"; import { WorkerFunction, WorkerModule } from "../types/worker"; declare type ArbitraryWorkerInterface = WorkerFunction & WorkerModule & { somekeythatisneverusedinproductioncode123: "magicmarker123"; }; declare type ArbitraryThreadType = FunctionThread & ModuleThread; declare type ExposedToThreadType> = Exposed extends ArbitraryWorkerInterface ? ArbitraryThreadType : Exposed extends WorkerFunction ? FunctionThread, StripAsync>> : Exposed extends WorkerModule ? ModuleThread : never; /** * Spawn a new thread. Takes a fresh worker instance, wraps it in a thin * abstraction layer to provide the transparent API and verifies that * the worker has initialized successfully. * * @param worker Instance of `Worker`. Either a web worker, `worker_threads` worker or `tiny-worker` worker. * @param [options] * @param [options.timeout] Init message timeout. Default: 10000 or set by environment variable. */ export declare function spawn = ArbitraryWorkerInterface>(worker: WorkerType, options?: { timeout?: number; }): Promise>; export {};