Update npmpublish.yml
[poolifier.git] / src / worker / abstract-worker.ts
index 4a6241a8ccfdb1c7426504568989c3c293983405..8dcaa4c4d4d9e5553cb2398921d49ec33f2eed9f 100644 (file)
@@ -43,7 +43,7 @@ export abstract class AbstractWorker<
     type: string,
     isMain: boolean,
     fn: (data: Data) => Response,
-    protected mainWorker?: MainWorker | null,
+    protected mainWorker: MainWorker | null,
     public readonly opts: WorkerOptions = {
       /**
        * The kill behavior option on this Worker or its default value.
@@ -163,7 +163,7 @@ export abstract class AbstractWorker<
       const res = fn(value.data)
       this.sendToMainWorker({ data: res, id: value.id })
     } catch (e) {
-      const err = this.handleError(e)
+      const err = this.handleError(e as Error)
       this.sendToMainWorker({ error: err, id: value.id })
     } finally {
       this.lastTaskTimestamp = Date.now()