无法破坏 Deno(Typescript) 中请求的值

Can't Destruct the value from request in Deno(Typescript)

我想从 API 请求中销毁值,但我无法销毁请求值。这里出了什么问题?

error

按照此模式销毁对象:

const response: any = await ...
const { title, body } = response;

p.s。您的代码段中的语法无效,或者至少我不熟悉它,但绝对不适合解构。

我们需要在 destruct 之前解析 body 对象中的 value promise

试试这个:

const body = await ctx.request.body();

if(body.type === 'json'){
  const {title,body} = await body.value;
}