Promise<Type1> 结果实际上是通过调用另一个返回 Promise<Type2> . 我该怎么做?以下内容正确吗?谢谢
Promise<Type1>
Promise<Type2>
function1():Promise<Type1>{ return function2().then(result => {...some code that convert the result (Type2) to a Type1 object...}); }
.then()
function1 您的实际退货类型应为 Type2 :
function1
Type2
function1(): Promise<Type2>{ return function2.then(result => {...some code that convert the result (Type1) to a Type2 object...}); }