Node.js 使用Bluebird会在typescript中引发编译错误

Node.js 使用Bluebird会在typescript中引发编译错误,node.js,typescript,promise,bluebird,Node.js,Typescript,Promise,Bluebird,我犯了一个错误 Bluebird<{}>' is not assignable to type 'Bluebird<boolean> Bluebird'不能分配给类型'Bluebird' 在编译以下代码时 import * as Promise from 'bluebird' function getPromise() : Promise<boolean> { return new Promise((resolve, reject) =>

我犯了一个错误

Bluebird<{}>' is not assignable to type 'Bluebird<boolean>
Bluebird'不能分配给类型'Bluebird'
在编译以下代码时

import * as Promise from 'bluebird'

function getPromise() : Promise<boolean> {
    return new Promise((resolve, reject) => {
        resolve(true);
    })
}

let p : Promise<boolean> = getPromise();
p.then(a => console.log("Done"));
import*作为“蓝鸟”的承诺
函数getPromise():Promise{
返回新承诺((解决、拒绝)=>{
决心(正确);
})
}
设p:Promise=getPromise();
p、 然后(a=>console.log(“Done”);
蓝鸟版本-3.5.1

节点版本-6.10.3


Typescript版本-2.3.1

这在较新版本的Typescript中不是一个问题,在较新版本中,
new Promise
的通用参数将由预期的返回类型推断出来。但是,在2.3中,必须明确指定
Promise
的通用参数:

function getPromise() : Promise<boolean> {
    return new Promise<boolean>((resolve, reject) => {
        resolve(true);
    })
}
函数getPromise():Promise{ 返回新承诺((解决、拒绝)=>{ 决心(正确); }) }