Skip to content

Commit 98f3036

Browse files
committed
fix(node-runtime-worker-thread): Fix TS errors
1 parent ad2c5bb commit 98f3036

File tree

1 file changed

+13
-7
lines changed
  • packages/node-runtime-worker-thread/src

1 file changed

+13
-7
lines changed

packages/node-runtime-worker-thread/src/index.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { once } from 'events';
12
import { ChildProcess } from 'child_process';
23
import { MongoClientOptions } from '@mongosh/service-provider-core';
34
import { Runtime } from '@mongosh/browser-runtime-core';
@@ -16,22 +17,24 @@ class WorkerEvaluationListener {
1617
this.exposedListener = exposeAll<EvaluationListener>(
1718
{
1819
onPrompt(question, type) {
19-
return workerRuntime.evaluationListener.onPrompt?.(question, type) ?? '';
20+
return (
21+
workerRuntime.evaluationListener?.onPrompt?.(question, type) ?? ''
22+
);
2023
},
2124
onPrint(values) {
2225
return workerRuntime.evaluationListener?.onPrint?.(values);
23-
}
2426
},
2527
toggleTelemetry(enabled) {
2628
return workerRuntime.evaluationListener?.toggleTelemetry?.(enabled);
27-
}
2829
},
2930
onClearCommand() {
30-
return workerRuntime.evaluationListener.onClearCommand?.();
31+
return workerRuntime.evaluationListener?.onClearCommand?.();
3132
},
3233
onExit() {
33-
return workerRuntime.evaluationListener?.onExit?.() ??
34-
Promise.resolve() as Promise<never>;
34+
return (
35+
workerRuntime.evaluationListener?.onExit?.() ??
36+
(Promise.resolve() as Promise<never>)
37+
);
3538
}
3639
},
3740
childProcess
@@ -102,7 +105,10 @@ class WorkerRuntime implements Runtime {
102105
async terminate() {
103106
await this.initWorkerPromise;
104107
this.childProcess.kill('SIGTERM');
105-
if (this.childProcess.exitCode === null && this.childProcess.signalCode === null) {
108+
if (
109+
this.childProcess.exitCode === null &&
110+
this.childProcess.signalCode === null
111+
) {
106112
await once(this.childProcess, 'exit');
107113
}
108114
}

0 commit comments

Comments
 (0)