refactor: turn on `noImplicitOverride` in TS configuration
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 19 Sep 2024 12:46:29 +0000 (14:46 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 19 Sep 2024 12:46:29 +0000 (14:46 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
21 files changed:
examples/typescript/http-client-pool/tsconfig.json
examples/typescript/http-server-pool/express-cluster/tsconfig.json
examples/typescript/http-server-pool/express-hybrid/tsconfig.json
examples/typescript/http-server-pool/express-worker_threads/tsconfig.json
examples/typescript/http-server-pool/fastify-cluster/tsconfig.json
examples/typescript/http-server-pool/fastify-hybrid/tsconfig.json
examples/typescript/http-server-pool/fastify-worker_threads/tsconfig.json
examples/typescript/smtp-client-pool/tsconfig.json
examples/typescript/websocket-server-pool/ws-cluster/tsconfig.json
examples/typescript/websocket-server-pool/ws-hybrid/tsconfig.json
examples/typescript/websocket-server-pool/ws-worker_threads/tsconfig.json
src/pools/cluster/dynamic.ts
src/pools/cluster/fixed.ts
src/pools/selection-strategies/fair-share-worker-choice-strategy.ts
src/pools/selection-strategies/interleaved-weighted-round-robin-worker-choice-strategy.ts
src/pools/selection-strategies/least-busy-worker-choice-strategy.ts
src/pools/selection-strategies/least-elu-worker-choice-strategy.ts
src/pools/selection-strategies/weighted-round-robin-worker-choice-strategy.ts
src/pools/thread/dynamic.ts
src/worker/thread-worker.ts
tsconfig.json

index 19c730cb3bfc48460dd15e563cbf9e64c484f0f8..3eddea483b0a09d1965476982c40aef48e870ef1 100644 (file)
@@ -9,6 +9,7 @@
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index 19c730cb3bfc48460dd15e563cbf9e64c484f0f8..3eddea483b0a09d1965476982c40aef48e870ef1 100644 (file)
@@ -9,6 +9,7 @@
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index 19c730cb3bfc48460dd15e563cbf9e64c484f0f8..3eddea483b0a09d1965476982c40aef48e870ef1 100644 (file)
@@ -9,6 +9,7 @@
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index 19c730cb3bfc48460dd15e563cbf9e64c484f0f8..3eddea483b0a09d1965476982c40aef48e870ef1 100644 (file)
@@ -9,6 +9,7 @@
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index 19c730cb3bfc48460dd15e563cbf9e64c484f0f8..3eddea483b0a09d1965476982c40aef48e870ef1 100644 (file)
@@ -9,6 +9,7 @@
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index d688c5cefbc0b9ed9b6d0bd12ca83f8d68bd5860..016d5a668397efdc1dd0e53597bdbfa29e3ff256 100644 (file)
@@ -10,6 +10,7 @@
     "typeRoots": ["./node_modules/@types", "./@types"],
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index d688c5cefbc0b9ed9b6d0bd12ca83f8d68bd5860..016d5a668397efdc1dd0e53597bdbfa29e3ff256 100644 (file)
@@ -10,6 +10,7 @@
     "typeRoots": ["./node_modules/@types", "./@types"],
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index 19c730cb3bfc48460dd15e563cbf9e64c484f0f8..3eddea483b0a09d1965476982c40aef48e870ef1 100644 (file)
@@ -9,6 +9,7 @@
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index 19c730cb3bfc48460dd15e563cbf9e64c484f0f8..3eddea483b0a09d1965476982c40aef48e870ef1 100644 (file)
@@ -9,6 +9,7 @@
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index 19c730cb3bfc48460dd15e563cbf9e64c484f0f8..3eddea483b0a09d1965476982c40aef48e870ef1 100644 (file)
@@ -9,6 +9,7 @@
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index 19c730cb3bfc48460dd15e563cbf9e64c484f0f8..3eddea483b0a09d1965476982c40aef48e870ef1 100644 (file)
@@ -9,6 +9,7 @@
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true,
     "strict": true,
     "skipLibCheck": true
   }
index e52e91db5aa9ec76a6ee4f6c0625a9c45ef27839..014e3e8057333e97395bfc0b1a9ecea3efad7db2 100644 (file)
@@ -49,7 +49,7 @@ export class DynamicClusterPool<
   }
 
   /** @inheritDoc */
-  protected checkAndEmitDynamicWorkerCreationEvents (): void {
+  protected override checkAndEmitDynamicWorkerCreationEvents (): void {
     if (this.emitter != null) {
       if (!this.fullEventEmitted && this.full) {
         this.emitter.emit(PoolEvents.full, this.info)
@@ -62,7 +62,7 @@ export class DynamicClusterPool<
   }
 
   /** @inheritDoc */
-  protected checkAndEmitDynamicWorkerDestructionEvents (): void {
+  protected override checkAndEmitDynamicWorkerDestructionEvents (): void {
     if (this.emitter != null) {
       if (this.fullEventEmitted && !this.full) {
         this.emitter.emit(PoolEvents.fullEnd, this.info)
@@ -76,17 +76,17 @@ export class DynamicClusterPool<
   }
 
   /** @inheritDoc */
-  protected shallCreateDynamicWorker (): boolean {
+  protected override shallCreateDynamicWorker (): boolean {
     return (!this.full && this.internalBusy()) || this.empty
   }
 
   /** @inheritDoc */
-  protected get backPressure (): boolean {
+  protected override get backPressure (): boolean {
     return this.full && this.internalBackPressure()
   }
 
   /** @inheritDoc */
-  protected get busy (): boolean {
+  protected override get busy (): boolean {
     return this.full && this.internalBusy()
   }
 
@@ -113,7 +113,7 @@ export class DynamicClusterPool<
   }
 
   /** @inheritDoc */
-  protected get type (): PoolType {
+  protected override get type (): PoolType {
     return PoolTypes.dynamic
   }
 }
index e4df768ec3f3583989a75a3d82b7820610fe2c25..17b64c30c1e9af745d3a483356b2e8518d42574b 100644 (file)
@@ -96,7 +96,7 @@ export class FixedClusterPool<
   }
 
   /** @inheritDoc */
-  protected setupHook (): void {
+  protected override setupHook (): void {
     cluster.setupPrimary({ ...this.opts.settings, exec: this.filePath })
   }
 
index 92c8546cd5d1d0ad77c3c879160649864db168ed..23f751df54850f0251aa9a11ddfdf1e11d0fbf63 100644 (file)
@@ -24,23 +24,24 @@ export class FairShareWorkerChoiceStrategy<
   extends AbstractWorkerChoiceStrategy<Worker, Data, Response>
   implements IWorkerChoiceStrategy {
   /** @inheritDoc */
-  public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
-    elu: {
-      aggregate: true,
-      average: true,
-      median: false,
-    },
-    runTime: {
-      aggregate: true,
-      average: true,
-      median: false,
-    },
-    waitTime: {
-      aggregate: true,
-      average: true,
-      median: false,
-    },
-  }
+  public override readonly taskStatisticsRequirements: TaskStatisticsRequirements =
+    {
+      elu: {
+        aggregate: true,
+        average: true,
+        median: false,
+      },
+      runTime: {
+        aggregate: true,
+        average: true,
+        median: false,
+      },
+      waitTime: {
+        aggregate: true,
+        average: true,
+        median: false,
+      },
+    }
 
   /** @inheritDoc */
   public constructor (
index 36871f3cf46e2a967962ae74c426d1962da0aa7c..0db54c4fd7b6e7279da25512fa7f18c140402da8 100644 (file)
@@ -40,19 +40,20 @@ export class InterleavedWeightedRoundRobinWorkerChoiceStrategy<
    */
   private workerNodeVirtualTaskExecutionTime = 0
   /** @inheritDoc */
-  public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
-    elu: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
-    runTime: {
-      aggregate: true,
-      average: true,
-      median: false,
-    },
-    waitTime: {
-      aggregate: true,
-      average: true,
-      median: false,
-    },
-  }
+  public override readonly taskStatisticsRequirements: TaskStatisticsRequirements =
+    {
+      elu: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+      runTime: {
+        aggregate: true,
+        average: true,
+        median: false,
+      },
+      waitTime: {
+        aggregate: true,
+        average: true,
+        median: false,
+      },
+    }
 
   /** @inheritDoc */
   public constructor (
@@ -164,7 +165,9 @@ export class InterleavedWeightedRoundRobinWorkerChoiceStrategy<
   }
 
   /** @inheritDoc */
-  public setOptions (opts: undefined | WorkerChoiceStrategyOptions): void {
+  public override setOptions (
+    opts: undefined | WorkerChoiceStrategyOptions
+  ): void {
     super.setOptions(opts)
     this.roundWeights = this.getRoundWeights()
   }
index fba2350476b9de5f19339111c60e08f06cd58e33..5392cdd2301471ed462d08f81bd4c34ce9448846 100644 (file)
@@ -23,19 +23,20 @@ export class LeastBusyWorkerChoiceStrategy<
   extends AbstractWorkerChoiceStrategy<Worker, Data, Response>
   implements IWorkerChoiceStrategy {
   /** @inheritDoc */
-  public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
-    elu: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
-    runTime: {
-      aggregate: true,
-      average: false,
-      median: false,
-    },
-    waitTime: {
-      aggregate: true,
-      average: false,
-      median: false,
-    },
-  }
+  public override readonly taskStatisticsRequirements: TaskStatisticsRequirements =
+    {
+      elu: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+      runTime: {
+        aggregate: true,
+        average: false,
+        median: false,
+      },
+      waitTime: {
+        aggregate: true,
+        average: false,
+        median: false,
+      },
+    }
 
   /** @inheritDoc */
   public constructor (
index c7b86b8fce692722c6cd7fb0a0f192f0478b9ff0..8b0548c404c35ad450c8196136402125cb3d31c2 100644 (file)
@@ -23,15 +23,16 @@ export class LeastEluWorkerChoiceStrategy<
   extends AbstractWorkerChoiceStrategy<Worker, Data, Response>
   implements IWorkerChoiceStrategy {
   /** @inheritDoc */
-  public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
-    elu: {
-      aggregate: true,
-      average: false,
-      median: false,
-    },
-    runTime: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
-    waitTime: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
-  }
+  public override readonly taskStatisticsRequirements: TaskStatisticsRequirements =
+    {
+      elu: {
+        aggregate: true,
+        average: false,
+        median: false,
+      },
+      runTime: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+      waitTime: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+    }
 
   /** @inheritDoc */
   public constructor (
index 3cb062722e51c9db6f221d743559b50886c8d0b2..b3a4f1d855b628e7ead303baf85fc296b5d46d96 100644 (file)
@@ -29,19 +29,20 @@ export class WeightedRoundRobinWorkerChoiceStrategy<
   private workerNodeVirtualTaskExecutionTime = 0
 
   /** @inheritDoc */
-  public readonly taskStatisticsRequirements: TaskStatisticsRequirements = {
-    elu: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
-    runTime: {
-      aggregate: true,
-      average: true,
-      median: false,
-    },
-    waitTime: {
-      aggregate: true,
-      average: true,
-      median: false,
-    },
-  }
+  public override readonly taskStatisticsRequirements: TaskStatisticsRequirements =
+    {
+      elu: DEFAULT_MEASUREMENT_STATISTICS_REQUIREMENTS,
+      runTime: {
+        aggregate: true,
+        average: true,
+        median: false,
+      },
+      waitTime: {
+        aggregate: true,
+        average: true,
+        median: false,
+      },
+    }
 
   /** @inheritDoc */
   public constructor (
index b184da93a250d538b52cac4c783b5e3275dd5394..fdf1486eb7c2ae29416ad19ccbad53dbab37dac6 100644 (file)
@@ -49,7 +49,7 @@ export class DynamicThreadPool<
   }
 
   /** @inheritDoc */
-  protected checkAndEmitDynamicWorkerCreationEvents (): void {
+  protected override checkAndEmitDynamicWorkerCreationEvents (): void {
     if (this.emitter != null) {
       if (!this.fullEventEmitted && this.full) {
         this.emitter.emit(PoolEvents.full, this.info)
@@ -62,7 +62,7 @@ export class DynamicThreadPool<
   }
 
   /** @inheritDoc */
-  protected checkAndEmitDynamicWorkerDestructionEvents (): void {
+  protected override checkAndEmitDynamicWorkerDestructionEvents (): void {
     if (this.emitter != null) {
       if (this.fullEventEmitted && !this.full) {
         this.emitter.emit(PoolEvents.fullEnd, this.info)
@@ -76,17 +76,17 @@ export class DynamicThreadPool<
   }
 
   /** @inheritDoc */
-  protected shallCreateDynamicWorker (): boolean {
+  protected override shallCreateDynamicWorker (): boolean {
     return (!this.full && this.internalBusy()) || this.empty
   }
 
   /** @inheritDoc */
-  protected get backPressure (): boolean {
+  protected override get backPressure (): boolean {
     return this.full && this.internalBackPressure()
   }
 
   /** @inheritDoc */
-  protected get busy (): boolean {
+  protected override get busy (): boolean {
     return this.full && this.internalBusy()
   }
 
@@ -113,7 +113,7 @@ export class DynamicThreadPool<
   }
 
   /** @inheritDoc */
-  protected get type (): PoolType {
+  protected override get type (): PoolType {
     return PoolTypes.dynamic
   }
 }
index cd94753b5c977e8de64a65246c645981a4fd37c9..85ec86814466749a14513daa22bc0884997c699d 100644 (file)
@@ -58,12 +58,12 @@ export class ThreadWorker<
   /**
    * @inheritDoc
    */
-  protected handleError (error: Error | string): string {
+  protected override handleError (error: Error | string): string {
     return error as string
   }
 
   /** @inheritDoc */
-  protected handleKillMessage (message: MessageValue<Data>): void {
+  protected override handleKillMessage (message: MessageValue<Data>): void {
     super.handleKillMessage(message)
     this.port?.unref()
     this.port?.close()
index 96f8109ea239e7a7ead7fba75a5fdda7ab5b6ef8..df26738d28f74e03982e0489addb14ae6d43c363 100644 (file)
@@ -7,7 +7,8 @@
     "declarationDir": "./lib/dts",
     "strict": true,
     "verbatimModuleSyntax": true,
-    "forceConsistentCasingInFileNames": true
+    "forceConsistentCasingInFileNames": true,
+    "noImplicitOverride": true
   },
   "include": ["**/*.ts"],
   "exclude": ["node_modules", "lib"]