首页 > TAG信息列表 > MyReadonly2

[Typescript] 17. Medium - Readonly 2

Implement a generic MyReadonly2<T, K> which takes two type argument T and K. K specify the set of properties of T that should set to Readonly. When K is not provided, it should make all properties readonly just like the normal Readonly<T>. For

Typescript类型体操 - Readonly 2

题目 中文 实现一个通用MyReadonly2<T, K>,它带有两种类型的参数T和K。 K指定应设置为Readonly的T的属性集。如果未提供K,则应使所有属性都变为只读,就像普通的Readonly<T>一样。 例如 interface Todo { title: string description: string completed: boolean } const todo: