X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futility-types.ts;h=eb3f9727369f837d9cd36d5bd6b7dd69c9d5f0c3;hb=2b7fe616bca97733571e69ab361fd718ded0d9dc;hp=aa4d058cce142ffa5214c8d2ce2965e428309d14;hpb=729c563db85562dd7d0f7733b1a3e2d98467134b;p=poolifier.git diff --git a/src/utility-types.ts b/src/utility-types.ts index aa4d058c..eb3f9727 100644 --- a/src/utility-types.ts +++ b/src/utility-types.ts @@ -1,3 +1,6 @@ +import type { Worker } from 'cluster' +import type { MessagePort } from 'worker_threads' + /** * Make all properties in T non-readonly */ @@ -24,7 +27,10 @@ export type JSONArray = Array /** * Message object that is passed between worker and main worker. */ -export interface MessageValue { +export interface MessageValue< + Data = unknown, + MainWorker extends Worker | MessagePort | unknown = unknown +> { /** * Input data that will be passed to the worker. */ @@ -46,5 +52,5 @@ export interface MessageValue { * * _Only for internal use_ */ - readonly parent?: MessagePort + readonly parent?: MainWorker }