strictNullChecks: fix plugin runtime workers

- Add non-null assertions for worker and stdio access
- Add non-null assertions for kill() undefined assignments
This commit is contained in:
Koushik Dutta
2026-04-02 13:20:50 -07:00
parent 5f040f5ff4
commit f620c80589
3 changed files with 5 additions and 5 deletions

View File

@@ -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);

View File

@@ -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,

View File

@@ -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 {