When I tslint my whole project using tslint --project tsconfig.json src/**/*.ts
I get lots of tslint errors like these:
Invalid 'await' of a non-Promise value.
These errors pops up in every line where I am awaiting a Bluebird promise. I wonder what I should do to avoid these warnings? At runtime I don't face any issues, however I assume that there is a good reason to fix these issues?
For instance I am using the amqplib library which uses Bluebird for all promises. And every time I await one of the promise based methods I will get a tslint error:
const queueInfo: Replies.AssertQueue = await this.channel.assertQueue(this.jobQueueName);
Question:
What is the best way for awaiting non-Promise values like Bluebird promises?
It looks like TSLint contains a setting for indicating which types to treat as promises in await
expressions:
https://palantir.github.io/tslint/rules/await-promise/
I haven't tried this myself, but it looks like you should be able to use this to allow awaiting Bluebird promises:
"await-promise": [true, "Bluebird"]