Typescript 在返回承诺的函数上使用.then是抛出;这是不可调用的”;

Typescript 在返回承诺的函数上使用.then是抛出;这是不可调用的”;,typescript,es6-promise,Typescript,Es6 Promise,我正在导入一个模块,该模块具有一系列函数作为属性,并使用如下字符串访问函数: imported_module[typed enumerated string]().then(res => console.log(res)) 这会引发如下错误: This expression is not callable. Each member of the union type '(<TResult1 = UserResult, TResult2 = never>(onfulfill

我正在导入一个模块,该模块具有一系列函数作为属性,并使用如下字符串访问函数:

imported_module[typed enumerated string]().then(res => console.log(res))
这会引发如下错误:

This expression is not callable.
  Each member of the union type '(<TResult1 = UserResult, TResult2 = never>(onfulfilled?: ((value: UserResult) => TResult1 | PromiseLike<TResult1>) | null | undefine
d, onrejected?: ((reason: any) => TResult2 | PromiseLike<...>) | ... 1 more ... | undefined) => Promise<...>) | (<TResult1 = void, TResult2 = never>(onfulfilled?: ((
value: void) => TRes...' has signatures, but none of those signatures are compatible with each other.  TS2349
此表达式不可调用。
联合类型“((onCompleted?:((value:UserResult)=>TResult1 | PromiseLike)| null |未定义”的每个成员
d、 被拒绝:(原因:任何)=>TResult2 |承诺的)|…1更多…|未定义)=>承诺)|((未履行的?:((
value:void)=>TRes…'具有签名,但这些签名都不相互兼容。TS2349

我如何解决这个问题?这是软件包的问题吗?

您能告诉我问题是由导入的模块[键入枚举字符串]()还是
引起的吗?然后(…)
?虽然TypeScript错误消息听起来像是类型不匹配,但它对我来说很神秘,因此我可能会将语句分成两部分,看看是哪一部分导致了错误。您有导入模块的类型定义吗?您能告诉我问题是否是由导入的\u模块[typed enumerated string]()或
。然后(…)
?虽然听起来像是类型不匹配,但TypeScript错误消息对我来说很神秘,所以我可能会将语句分成两部分,看看是哪一部分导致错误。您有导入模块的类型定义吗?