在返回诺言的函数上使用.then会引发“此不可调用”

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

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

我该如何解决?包裹有问题吗?

wangruiyue 回答:在返回诺言的函数上使用.then会引发“此不可调用”

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2711307.html

大家都在问