你如何在 Flow 中阅读这个?

How do you read this in Flow?

我是他们使用流程的代码库的新手。

我有点不明白:

const {
  headers: { location },
}: Response = await httpClient.post(getChangeServicesUrl(userId), newChangeService);

你能解释一下发生了什么吗?

是吗,解构位置,然后冒号在做什么?

谢谢

const {
  headers: { location },
}: Response = await httpClient.post(...

相当于:

const response: Response = await httpClient.post(...
const location = response.headers.location;

所以第一部分是object destructuring

const {
  headers: { location },
}

: Response是一个type annotation