build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / src / charging-station / broadcast-channel / UIServiceWorkerBroadcastChannel.ts
index 57b4bc788fecf56ad3a9b467f7162d636634ad09..1157c71e5e09c164dc8e653545e962d1e9f98aa7 100644 (file)
@@ -1,4 +1,3 @@
-import { WorkerBroadcastChannel } from './WorkerBroadcastChannel.js'
 import {
   type BroadcastChannelResponse,
   type BroadcastChannelResponsePayload,
@@ -6,8 +5,9 @@ import {
   type ResponsePayload,
   ResponseStatus
 } from '../../types/index.js'
-import { isNullOrUndefined, logger } from '../../utils/index.js'
+import { logger } from '../../utils/index.js'
 import type { AbstractUIService } from '../ui-server/ui-services/AbstractUIService.js'
+import { WorkerBroadcastChannel } from './WorkerBroadcastChannel.js'
 
 const moduleName = 'UIServiceWorkerBroadcastChannel'
 
@@ -70,36 +70,39 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
         : ResponseStatus.FAILURE
     return {
       status: responsesStatus,
+      // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
       hashIdsSucceeded: this.responses
         .get(uuid)
         ?.responses.map(({ status, hashId }) => {
-          if (hashId !== undefined && status === ResponseStatus.SUCCESS) {
+          if (hashId != null && status === ResponseStatus.SUCCESS) {
             return hashId
           }
           return undefined
         })
-        .filter((hashId) => !isNullOrUndefined(hashId)) as string[],
+        .filter(hashId => hashId != null)!,
       ...(responsesStatus === ResponseStatus.FAILURE && {
+        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
         hashIdsFailed: this.responses
           .get(uuid)
           ?.responses.map(({ status, hashId }) => {
-            if (hashId !== undefined && status === ResponseStatus.FAILURE) {
+            if (hashId != null && status === ResponseStatus.FAILURE) {
               return hashId
             }
             return undefined
           })
-          .filter((hashId) => !isNullOrUndefined(hashId)) as string[]
+          .filter(hashId => hashId != null)!
       }),
       ...(responsesStatus === ResponseStatus.FAILURE && {
+        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain
         responsesFailed: this.responses
           .get(uuid)
-          ?.responses.map((response) => {
-            if (response !== undefined && response.status === ResponseStatus.FAILURE) {
+          ?.responses.map(response => {
+            if (response.status === ResponseStatus.FAILURE) {
               return response
             }
             return undefined
           })
-          .filter((response) => !isNullOrUndefined(response)) as BroadcastChannelResponsePayload[]
+          .filter(response => response != null)!
       })
     }
   }