【发布时间】:2021-03-13 15:20:06
【问题描述】:
例如我有这种类型:type mixed = {k1: string, k2: number}
现在我想要另一种类型(可以从一些泛型生成),只有来自 mixed 的 string 属性类型,如下所示:
type stringOnly = {k1: string} 其中k2 来自mixed 被省略。
如何在打字稿中做到这一点?谢谢!
【问题讨论】:
-
在这里翻译另一个问题的答案会产生this
标签: typescript