X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2Fthread-worker.ts;h=80b06ee9108f1b923a8a5af880e6803f678f649d;hb=d3c8a1a8022726094160d1413f1f289c5d84d715;hp=5a16026c497679a73332cc82a0fee704b5a5e72c;hpb=cda5cc74c77bdfc37b220ef19637876e221b5061;p=poolifier.git diff --git a/src/worker/thread-worker.ts b/src/worker/thread-worker.ts index 5a16026c..80b06ee9 100644 --- a/src/worker/thread-worker.ts +++ b/src/worker/thread-worker.ts @@ -1,5 +1,5 @@ import { isMainThread, parentPort } from 'worker_threads' -import type { MessageValue } from '../utility-types' +import type { JSONValue, MessageValue } from '../utility-types' import { AbstractWorker } from './abstract-worker' import type { WorkerOptions } from './worker-options' @@ -12,12 +12,10 @@ import type { WorkerOptions } from './worker-options' * @author [Alessandro Pio Ardizio](https://github.com/pioardi) * @since 0.0.1 */ -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export class ThreadWorker extends AbstractWorker< - MessagePort, - Data, - Response -> { +export class ThreadWorker< + Data extends JSONValue = JSONValue, + Response extends JSONValue = JSONValue +> extends AbstractWorker { protected parent?: MessagePort public constructor (fn: (data: Data) => Response, opts: WorkerOptions = {}) {