I am developing an application with nodejs / typescript and a mongodb database. To query the database, I use mongoose .
I just read an article from mongoose's documentation on how to connect an external promise library , and it is very simple:
import mongoose = require("mongoose");
import Promise = require("bluebird");
mongoose.Promise = Promise;
It works great. But I would like to expand / override the type of return promise.
Here is an example function:
public getModel= () => {
return MyModel.findOne().exec();
}
This function returns _mongoose.Promise<MyModel>, and I would like to return bluebird Promise<MyModel>, because I know that this is the promise of bluebird.
Is there a way to change / expand / override the mongoose request type returned? Should I write a custom definition file for my application? Any other suggestions would be appreciated.
Thank!