Skip to content

Commit 9661e67

Browse files
smcclure15MongoDB Bot
authored and
MongoDB Bot
committed
SERVER-103603: Support .d.ts typings for common "conn" and "db" workflows (#35071)
GitOrigin-RevId: cce8abff91406ea4ed5be849ea3e041b4ac0bc86
1 parent fe4ae2c commit 9661e67

File tree

7 files changed

+12
-15
lines changed

7 files changed

+12
-15
lines changed

jsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
"src/mongo/shell/*.js",
1212
"src/mongo/shell/*.d.ts",
1313
"src/third_party/fast_check/**/*"
14+
],
15+
"exclude": [
16+
"jstests/libs/override_methods/"
1417
]
1518
}

jstests/auth/auth1.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function setupTest() {
1010
print("START auth1.js");
1111
baseName = "jstests_auth_auth1";
1212

13-
m = MongoRunner.runMongod({auth: "", bind_ip: "127.0.0.1", useHostname: false});
13+
let m = MongoRunner.runMongod({auth: "", bind_ip: "127.0.0.1", useHostname: false});
1414
return m;
1515
}
1616

src/mongo/shell/collection.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ declare class DBCollection {
1212
getName()
1313
help()
1414
getFullName()
15-
getMongo()
16-
getDB()
15+
getMongo(): Mongo
16+
getDB(): DB
1717
find(filter, projection, limit, skip, batchSize, options)
1818
insert(obj, options)
1919
remove(t, justOne)

src/mongo/shell/db.d.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ declare class DB {
1717
[collectionIndex: string]: DBCollection
1818

1919
rotateCertificates(message)
20-
getMongo()
21-
getSiblingDB(name)
22-
getName()
20+
getSiblingDB(name): DB
2321
stats(opt)
24-
getCollection(name)
22+
getCollection(name): DBCollection
2523
commandHelp(name)
2624
runReadCommand()
2725
runCommand(obj, extra, queryOptions)

src/mongo/shell/mongo.d.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22

33
declare class Mongo {
44
constructor(uri?: string, encryptedDBClientCallback?, options?: object)
5-
6-
getDB(name): DB
7-
85
startSession(opts?): DriverSession
9-
106
find(ns, query, fields, limit, skip, batchSize, options)
117
insert(ns, obj)
128
remove(ns, pattern)
@@ -15,7 +11,7 @@ declare class Mongo {
1511
getSlaveOk()
1612
setSecondaryOk(value = true)
1713
getSecondaryOk()
18-
getDB(name)
14+
getDB(name: string): DB
1915
getDBs(driverSession)
2016
adminCommand(cmd)
2117
runCommand(dbname, cmd, options)

src/mongo/shell/servers.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// type declarations for servers.js
22

33
declare module MongoRunner {
4-
export function runMongod(opts?: object): Mongo
5-
export function stopMongod(connection: Mongo): void
4+
function runMongod(opts?: object): Mongo
5+
function stopMongod(connection: Mongo): void
66
}
77

88
declare function myPort()

src/mongo/shell/utils_sh.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// type declarations for utils_sh.js
22

3-
declare var db
3+
declare var db: DB
44
declare function printShardingStatus()

0 commit comments

Comments
 (0)