-export default class WorkerFactory {
- public static getWorkerImpl<T>(workerScript: string, workerProcessType: WorkerProcessType, options?: WorkerOptions): Wrk {
- if (Utils.isUndefined(options)) {
- options = {} as WorkerOptions;
+import type { WorkerAbstract } from './WorkerAbstract.js'
+import { DEFAULT_WORKER_OPTIONS } from './WorkerConstants.js'
+import { WorkerDynamicPool } from './WorkerDynamicPool.js'
+import { WorkerFixedPool } from './WorkerFixedPool.js'
+import { WorkerSet } from './WorkerSet.js'
+import { type WorkerData, type WorkerOptions, WorkerProcessType } from './WorkerTypes.js'
+
+// eslint-disable-next-line @typescript-eslint/no-extraneous-class
+export class WorkerFactory {
+ private constructor () {
+ // This is intentional
+ }
+
+ public static getWorkerImplementation<D extends WorkerData, R extends WorkerData>(
+ workerScript: string,
+ workerProcessType: WorkerProcessType,
+ workerOptions?: WorkerOptions
+ ): WorkerAbstract<D, R> {
+ if (!isMainThread) {
+ throw new Error('Cannot get a worker implementation outside the main thread')