-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
-
Correctness
-
Correctness 2025-04-29
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Many JS tests do something like the following:
const conn = MongoRunner.runMongod(); const db = conn.getDB("test"); const coll = db.getCollection(jsTestName()); assert.commandWorked(coll.stats()) coll.drop();
But since the IDE can't put together what type the initial conn variable is (becomes an "any" or even a "never" due to overrides), the rest can't get any helpful hints from .d.ts type files.
This might be a limitation of not having well-scoped variables (global, not using exports, etc), but some mitigation may exist to help provide devs with better UX without a large amount of churn (redesign!) to the system.
Ideally, solutions should extend beyond just these two variables, or to at least demonstrate an example for others to follow suit.