我想使用函数的返回类型在界面上键入一个项目,如下所示:
const returnsPromise = async (): Promise<string> => {
return Promise.resolve('I want the string type and not a Promise')
}
interface Myinterface {
message: ReturnType<typeof returnsPromise>
}Run Code Online (Sandbox Code Playgroud)
但是,消息的类型是Promise而不是string。人们可以得到 Promise 应该解决的类型吗?
typescript ×1