Mongoose Promise

Hello,

we startet useing sonarcloud to get some analysis of our NodeJS, typescript code. There are a lot of Code Smells regarding:
“await” should only be used with promises

There is also a question on Stackoverflow regarding this issue:
Mongoose promise and sonarqube

Example Code line:

noti = await notificatinModel.findOne({ '_id': new ObjectId(body.id_noti) }).lean();

Configuration of Mongoose:

import mongoose from "mongoose";

mongoose.Promise = Promise;

export default async () => {
    await mongoose.connect(config.get('mongo.connectionString'), { useUnifiedTopology: true, useNewUrlParser: true });
}

The rule is relying on presence of then method on the type of await argument. It’s weird that we report while you claim there is a then method.

Could you provide minimal reproducer project? With TS and package.json file so that I could try to reproduce type resolution on my side.