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.
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()