refactor: switch eslint configuration to strict type checking
[e-mobility-charging-stations-simulator.git] / src / performance / PerformanceStatistics.ts
index f61d095874f9dafbde0df907b7ad60e58f504098..88ea748c635bbdea9023c24819740d8184e749dc 100644 (file)
@@ -41,19 +41,19 @@ export class PerformanceStatistics {
   PerformanceStatistics
   >()
 
-  private readonly objId: string
-  private readonly objName: string
+  private readonly objId: string | undefined
+  private readonly objName: string | undefined
   private performanceObserver!: PerformanceObserver
   private readonly statistics: Statistics
   private displayInterval?: NodeJS.Timeout
 
-  private constructor (objId: string, objName: string, uri: URL) {
-    this.objId = objId
-    this.objName = objName
+  private constructor (objId: string | undefined, objName: string | undefined, uri: URL) {
+    this.objId = objId ?? 'Object id not specified'
+    this.objName = objName ?? 'Object name not specified'
     this.initializePerformanceObserver()
     this.statistics = {
-      id: this.objId ?? 'Object id not specified',
-      name: this.objName ?? 'Object name not specified',
+      id: this.objId,
+      name: this.objName,
       uri: uri.toString(),
       createdAt: new Date(),
       statisticsData: new Map()
@@ -164,7 +164,7 @@ export class PerformanceStatistics {
     this.stopLogStatisticsInterval()
     performance.clearMarks()
     performance.clearMeasures()
-    this.performanceObserver?.disconnect()
+    this.performanceObserver.disconnect()
   }
 
   public restart (): void {
@@ -185,7 +185,7 @@ export class PerformanceStatistics {
   }
 
   private logStatistics (): void {
-    logger.info(`${this.logPrefix()}`, {
+    logger.info(this.logPrefix(), {
       ...this.statistics,
       statisticsData: JSONStringifyWithMapSupport(this.statistics.statisticsData)
     })