I have a nodejs / typescript 2 project and use the es6-promise package. Now i would like to get rid of the extra package because i can target ES6 in typescript directly.
So i removed the es6-promise package and changed the tsconfig.json to target es6.
{
"compilerOptions": {
"target": "es6",
// ...
}
}
Many 3rd party packages uses the Bluebird promise but the promise definition is incompatible to the default es6 promise as stated on different posts on github
- bluebird 3.0 definifion is not assignable to ES6 Promises
- Provide a way to load Bluebird globally in es6 compilation target.
- Add Symbol.toStringTag to promise instance
So i am getting the following error.
TS2322: Type 'Bluebird' is not assignable to type 'Promise'. Property '[Symbol.toStringTag]' is missing in type 'Bluebird'.
There is a other types package on npm @types/bluebird-global. In one of the blog post a user suggests to use it instead of @types/bluebird but some 3rd party packages (e.g. sequelize typings) reference bluebird and not bluebird-global so i get another error for the missing typings of bluebird.
What is a good solution to get this to work?
interface Bluebird { [Symbol.toStringTag]: string }
in a filebluebird-patch.d.ts
? – Subsequent