diff --git a/server/src/plugin/runtime/custom-worker.ts b/server/src/plugin/runtime/custom-worker.ts index 501357021..f816785d0 100644 --- a/server/src/plugin/runtime/custom-worker.ts +++ b/server/src/plugin/runtime/custom-worker.ts @@ -52,8 +52,8 @@ export class CustomRuntimeWorker extends ChildProcessWorker { } setupRpcPeer(peer: RpcPeer): void { - const peerin = this.worker.stdio[3] as Writable; - const peerout = this.worker.stdio[4] as Readable; + const peerin = this.worker!.stdio[3]! as Writable; + const peerout = this.worker!.stdio[4]! as Readable; const serializer = this.serializer = createRpcDuplexSerializer(peerin); serializer.setupRpcPeer(peer); diff --git a/server/src/plugin/runtime/node-fork-worker.ts b/server/src/plugin/runtime/node-fork-worker.ts index 98f85046e..433246cb9 100644 --- a/server/src/plugin/runtime/node-fork-worker.ts +++ b/server/src/plugin/runtime/node-fork-worker.ts @@ -77,7 +77,7 @@ export class NodeForkWorker extends ChildProcessWorker { } setupRpcPeer(peer: RpcPeer): void { - this.worker.on('message', (message, sendHandle) => { + this.worker!.on('message', (message, sendHandle) => { if ((message as any).type && sendHandle) { peer.handleMessage(message as any, { sendHandle, diff --git a/server/src/plugin/runtime/node-thread-worker.ts b/server/src/plugin/runtime/node-thread-worker.ts index 29c3288b7..17a0e32a8 100644 --- a/server/src/plugin/runtime/node-thread-worker.ts +++ b/server/src/plugin/runtime/node-thread-worker.ts @@ -104,8 +104,8 @@ export class NodeThreadWorker extends EventEmitter implements RuntimeWorker { return; this.worker.terminate(); this.port.close(); - this.port = undefined; - this.worker = undefined; + this.port = undefined!; + this.worker = undefined!; } send(message: RpcMessage, reject?: (e: Error) => void, serializationContext?: any): void {