refactor: silence linter
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 21 Jun 2024 10:42:47 +0000 (12:42 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Fri, 21 Jun 2024 10:42:47 +0000 (12:42 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/broadcast-channel/UIServiceWorkerBroadcastChannel.ts
src/charging-station/ui-server/ui-services/AbstractUIService.ts

index ef07b5dac21abda443378f0ad0470b14f0bb4403..1157c71e5e09c164dc8e653545e962d1e9f98aa7 100644 (file)
@@ -70,6 +70,7 @@ 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 }) => {
@@ -78,8 +79,9 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
           }
           return undefined
         })
-        .filter(hashId => hashId != null) 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 }) => {
@@ -88,9 +90,10 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
             }
             return undefined
           })
-          .filter(hashId => hashId != null) 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 => {
@@ -99,7 +102,7 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
             }
             return undefined
           })
-          .filter(response => response != null) as BroadcastChannelResponsePayload[]
+          .filter(response => response != null)!
       })
     }
   }
index ffdc256583adccd581d72c99496e3bfe726333e2..e37c632b391e37360644c0fc58ac1b9bee91a60e 100644 (file)
@@ -223,7 +223,7 @@ export abstract class AbstractUIService {
           )
           return undefined
         })
-        .filter(hashId => hashId != null) as string[]
+        .filter(hashId => hashId != null)
     } else {
       delete payload.hashIds
     }