by Anthony Fu @antfu
由谷歌自动翻译,欢迎 PR 改进翻译质量。
实现泛型GetReadonlyKeys<T>
,该GetReadonlyKeys<T>
返回对象的只读键的并集。
例如
interface Todo {
readonly title: string
readonly description: string
completed: boolean
}
type Keys = GetReadonlyKeys<Todo> // expected to be "title" | "description"