From 25c4928dc79797954c5812d11c73032c4b856e10 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Tue, 26 Nov 2024 14:45:42 +1300 Subject: [PATCH] Fix optional value --- .../node-core/src/indexer/worker/worker.monitor.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/node-core/src/indexer/worker/worker.monitor.service.ts b/packages/node-core/src/indexer/worker/worker.monitor.service.ts index 57fa1b5add..9b766e92c4 100644 --- a/packages/node-core/src/indexer/worker/worker.monitor.service.ts +++ b/packages/node-core/src/indexer/worker/worker.monitor.service.ts @@ -7,12 +7,12 @@ import {setMonitorService} from '../../process'; import {MonitorServiceInterface} from '../monitor.service'; type HostMonitorService = { - hostMonitorServiceWrite: (blockData: string) => void; + hostMonitorServiceWrite?: (blockData: string) => void; }; export const hostMonitorKeys: (keyof HostMonitorService)[] = ['hostMonitorServiceWrite']; -export function monitorHostFunctions(host: MonitorServiceInterface): HostMonitorService { +export function monitorHostFunctions(host?: MonitorServiceInterface): HostMonitorService { return { hostMonitorServiceWrite: host?.write.bind(host), }; @@ -20,7 +20,7 @@ export function monitorHostFunctions(host: MonitorServiceInterface): HostMonitor @Injectable() export class WorkerMonitorService implements MonitorServiceInterface { - constructor(private host: HostMonitorService) { + constructor(private host?: HostMonitorService) { if (isMainThread) { throw new Error('Expected to be worker thread'); }