Skip to content

Commit 5d3ba50

Browse files
authored
chore: infer MongoClientOptions type instead of importing it (#403)
Rather than importing it, define it in a slightly more reliable way by referring to the second argument of `CliServiceProvider.connect()`. For example, this also enables usage of `tlsUseSystemCA`, which is included in `DevtoolsConnectOptions` (which is now the actual type accepted by `CliServiceProvider.connect()`) but not in the driver's `MongoClientOptions`.
1 parent 87484f8 commit 5d3ba50

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/language/worker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { CliServiceProvider } from '@mongosh/service-provider-server';
2-
import type { MongoClientOptions } from '@mongosh/service-provider-server';
32
import { CompletionItemKind } from 'vscode-languageserver/node';
43
import { EJSON, Document } from 'bson';
54
import { ElectronRuntime } from '@mongosh/browser-runtime-electron';
@@ -8,6 +7,9 @@ import { parentPort, workerData } from 'worker_threads';
87
import { PlaygroundResult, PlaygroundDebug, ShellExecuteAllResult } from '../types/playgroundType';
98
import { ServerCommands } from './serverCommands';
109

10+
// MongoClientOptions is the second argument of CliServiceProvider.connect(connectionStr, options)
11+
type MongoClientOptions = NonNullable<Parameters<(typeof CliServiceProvider)['connect']>[1]>;
12+
1113
interface EvaluationResult {
1214
printable: any;
1315
type: string | null;

0 commit comments

Comments
 (0)