Skip to content

Commit

Permalink
Fix optional value
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Nov 26, 2024
1 parent f8f43b0 commit 25c4928
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ 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),
};
}

@Injectable()
export class WorkerMonitorService implements MonitorServiceInterface {
constructor(private host: HostMonitorService) {
constructor(private host?: HostMonitorService) {
if (isMainThread) {
throw new Error('Expected to be worker thread');
}
Expand Down

0 comments on commit 25c4928

Please sign in to comment.