mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-14 12:09:04 +08:00
@types/connect-mongo Add Promise constructor and fix spelling mistake (#20178)
* Added Promise constructor and fixed spelling mistake * Fix spacing * Merged types in constructor and added test
This commit is contained in:
committed by
Ryan Cavanaugh
parent
e07dba0a0e
commit
5069d22d33
@@ -43,3 +43,11 @@ app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({db: mongoDb})
|
||||
}));
|
||||
|
||||
// NativeMongoPromiseOptions
|
||||
var Client = mongodb.MongoClient;
|
||||
var mongoDbPromise = Client.connect('mongodb://localhost/test');
|
||||
app.use(session({
|
||||
secret: 'secret',
|
||||
store: new MongoStore({ dbPromise: mongoDbPromise})
|
||||
}));
|
||||
|
||||
10
types/connect-mongo/index.d.ts
vendored
10
types/connect-mongo/index.d.ts
vendored
@@ -91,14 +91,16 @@ declare namespace connectMongo {
|
||||
mongooseConnection: mongoose.Connection;
|
||||
}
|
||||
|
||||
export interface NaitiveMongoOptions extends DefaultOptions {
|
||||
export interface NativeMongoOptions extends DefaultOptions {
|
||||
db: mongodb.Db;
|
||||
}
|
||||
|
||||
export interface NativeMongoPromiseOptions extends DefaultOptions {
|
||||
dbPromise: Promise<mongodb.Db>;
|
||||
}
|
||||
|
||||
export interface MongoStoreFactory {
|
||||
new (options: MongoUrlOptions): MongoStore;
|
||||
new (options: MogooseConnectionOptions): MongoStore;
|
||||
new (options: NaitiveMongoOptions): MongoStore;
|
||||
new(options: MongoUrlOptions | MogooseConnectionOptions | NativeMongoOptions | NativeMongoPromiseOptions): MongoStore;
|
||||
}
|
||||
|
||||
export class MongoStore extends session.Store {
|
||||
|
||||
Reference in New Issue
Block a user