1 | import { FunctionThread, ModuleThread, StripAsync, Worker as WorkerType } from "../types/master";
|
2 | import { WorkerFunction, WorkerModule } from "../types/worker";
|
3 | declare type ArbitraryWorkerInterface = WorkerFunction & WorkerModule<string> & {
|
4 | somekeythatisneverusedinproductioncode123: "magicmarker123";
|
5 | };
|
6 | declare type ArbitraryThreadType = FunctionThread<any, any> & ModuleThread<any>;
|
7 | declare type ExposedToThreadType<Exposed extends WorkerFunction | WorkerModule<any>> = Exposed extends ArbitraryWorkerInterface ? ArbitraryThreadType : Exposed extends WorkerFunction ? FunctionThread<Parameters<Exposed>, StripAsync<ReturnType<Exposed>>> : Exposed extends WorkerModule<any> ? ModuleThread<Exposed> : never;
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | export declare function spawn<Exposed extends WorkerFunction | WorkerModule<any> = ArbitraryWorkerInterface>(worker: WorkerType, options?: {
|
18 | timeout?: number;
|
19 | }): Promise<ExposedToThreadType<Exposed>>;
|
20 | export {};
|