fix: fix worker function type definition and validation
[poolifier.git] / src / worker / thread-worker.ts
index ac775a09842c970629a07ef29fa5b961a8e53a9c..ad2bc644220289c596420513208dd2b77b5db00d 100644 (file)
@@ -28,7 +28,10 @@ export class ThreadWorker<
    * @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-thread-pool:poolifier', isMainThread, fn, parentPort, opts)
   }