refactor: add type for worker configuration attribute
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 29 Nov 2023 19:11:39 +0000 (20:11 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 29 Nov 2023 19:11:39 +0000 (20:11 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/types/ConfigurationData.ts
src/utils/ConfigurationUtils.ts

index cac786897ae33744d126777b032e1c5d6cf21db2..df362b5390c9b0827ea5a11713de88228212ab55 100644 (file)
@@ -64,10 +64,12 @@ export interface StorageConfiguration {
   uri?: string;
 }
 
+export type elementsPerWorkerType = number | 'auto' | 'all';
+
 export interface WorkerConfiguration {
   processType?: WorkerProcessType;
   startDelay?: number;
-  elementsPerWorker?: number | 'auto' | 'all';
+  elementsPerWorker?: elementsPerWorkerType;
   elementStartDelay?: number;
   poolMinSize?: number;
   poolMaxSize?: number;
index 50bad0fad6fe8be75da647b4c9d875d681d1f975..660bc7649f2fcc4f7106263a696fa69aea3a279a 100644 (file)
@@ -6,6 +6,7 @@ import chalk from 'chalk';
 import { Constants } from './Constants';
 import { isNotEmptyString, logPrefix as utilsLogPrefix } from './Utils';
 import { FileType, StorageType } from '../types';
+import type { elementsPerWorkerType } from '../types/ConfigurationData';
 import { WorkerProcessType } from '../worker';
 
 export const logPrefix = (): string => {
@@ -68,7 +69,7 @@ export const checkWorkerProcessType = (workerProcessType: WorkerProcessType): vo
 };
 
 export const checkWorkerElementsPerWorker = (
-  elementsPerWorker: number | 'auto' | 'all' | undefined,
+  elementsPerWorker: elementsPerWorkerType | undefined,
 ): void => {
   if (
     elementsPerWorker !== undefined &&