rpc-worker.d.ts 617 B

12345678910111213
  1. /// <reference types="node" />
  2. import type { ChildProcess } from 'child_process';
  3. import type { RpcMethod, RpcRemoteMethod } from './types';
  4. interface RpcWorkerBase {
  5. connect(): void;
  6. terminate(): void;
  7. readonly connected: boolean;
  8. readonly process: ChildProcess | undefined;
  9. }
  10. declare type RpcWorker<T extends RpcMethod = RpcMethod> = RpcWorkerBase & RpcRemoteMethod<T>;
  11. declare function createRpcWorker<T extends RpcMethod>(modulePath: string, data: unknown, memoryLimit?: number): RpcWorker<T>;
  12. declare function getRpcWorkerData(): unknown;
  13. export { createRpcWorker, getRpcWorkerData, RpcWorker };