fix: fix worker function type definition and validation
[poolifier.git] / src / worker / cluster-worker.ts
index 655520ccedb84aeccc0c1231dfb7c4566747e2c0..1d2729812f905d9f9724e5bf9106358ae8aa893a 100644 (file)
@@ -28,7 +28,10 @@ export class ClusterWorker<
    * @param fn - Function processed by the worker when the pool's `execution` function is invoked.
    * @param opts - Options for the worker.
    */
-  public constructor (fn: (data: Data) => Response, opts: WorkerOptions = {}) {
+  public constructor (
+    fn: (data: Data) => Response | Promise<Response>,
+    opts: WorkerOptions = {}
+  ) {
     super(
       'worker-cluster-pool:poolifier',
       cluster.isPrimary,