You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use ES6 Promises for Mongoose ODM in TypeScrpt.
I have the following line
mongoose.Promise=Promise;// as instructed by MongooseJs docs to use ES6 futures
Which give me the following error:
error TS2322: Type 'PromiseConstructor' is not assignable to type'typeof Promise'.
Type 'Promise<any>' is not assignable to type'Promise<any>'.
Property 'end' is missing intype'Promise<any>'.
I think this could be a bug from .d.ts file of mongoose
Hi,
this is a problem, because Promise is not defined on the Mongoose class. Add Promise there and remove the MPromise definition at the bottom of the definition file and it will work as expected.
Activity
vvakame commentedon Feb 26, 2016
umm... I don't have a answer. you can try
mongoose.Promise = Promise as any;.Thomas-P commentedon May 14, 2016
Hi,
this is a problem, because Promise is not defined on the Mongoose class. Add Promise there and remove the MPromise definition at the bottom of the definition file and it will work as expected.
I have send a pull request, for this issue #9334
Updates to Mongoose 4.5.x (DefinitelyTyped#10084)