Only allow primitive JSON for transfer between worker and main worker (#128)
[poolifier.git] / src / pools / cluster / fixed.ts
index 00205449a2f3fc0bee0feb54b7d41bea56b8ad62..b4071407f6e23864f2f34e4ea4da5d5d042333fc 100644 (file)
@@ -1,5 +1,5 @@
 import { fork, isMaster, setupMaster, Worker } from 'cluster'
-import type { MessageValue } from '../../utility-types'
+import type { JSONValue, MessageValue } from '../../utility-types'
 import type { PoolOptions } from '../abstract-pool'
 import { AbstractPool } from '../abstract-pool'
 
@@ -21,12 +21,10 @@ export interface ClusterPoolOptions extends PoolOptions<Worker> {
  * @author [Christopher Quadflieg](https://github.com/Shinigami92)
  * @since 2.0.0
  */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export class FixedClusterPool<Data = any, Response = any> extends AbstractPool<
-  Worker,
-  Data,
-  Response
-> {
+export class FixedClusterPool<
+  Data extends JSONValue = JSONValue,
+  Response extends JSONValue = JSONValue
+> extends AbstractPool<Worker, Data, Response> {
   /**
    * @param numWorkers Number of workers for this pool.
    * @param filePath A file path with implementation of `ClusterWorker` class, relative path is fine.