Only allow primitive JSON for transfer between worker and main worker (#128)
[poolifier.git] / src / pools / thread / dynamic.ts
index d6a6e1ba870f9d1938e42f0dc0f70bf844243448..51dca2f33698aede373eb2b95871f6d0dbc5ca84 100644 (file)
@@ -1,4 +1,4 @@
-import type { MessageValue } from '../../utility-types'
+import type { JSONValue, MessageValue } from '../../utility-types'
 import type { PoolOptions } from '../abstract-pool'
 import type { ThreadWorkerWithMessageChannel } from './fixed'
 import { FixedThreadPool } from './fixed'
@@ -13,10 +13,8 @@ import { FixedThreadPool } from './fixed'
  * @since 0.0.1
  */
 export class DynamicThreadPool<
-  // eslint-disable-next-line @typescript-eslint/no-explicit-any
-  Data = any,
-  // eslint-disable-next-line @typescript-eslint/no-explicit-any
-  Response = any
+  Data extends JSONValue = JSONValue,
+  Response extends JSONValue = JSONValue
 > extends FixedThreadPool<Data, Response> {
   /**
    * @param min Min number of threads that will be always active