【草稿】在 Typescript 中从对象中动态解构接口类型
问题
interface A {
title: string,
description: string,
}
let a = {
title: "title a",
description: "description a",
url: "http://example.com/a"
}
是否可以直接将a转换为接口A的类型
\\ 伪代码
let b = {...a as A};
\\ 使得
b = {
title: "title a",
description: "description a"
}

浙公网安备 33010602011771号