You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
314 B
10 lines
314 B
// 泛型工具类型:Pick<Type, Keys> 从 Type 中选择一组属性来构造新类型
|
|
|
|
interface Props{
|
|
id: string
|
|
title: string
|
|
children: number[]
|
|
}
|
|
|
|
// 从 Props 中选择两个属性给 PickProps
|
|
type PickProps = Pick<Props, 'id' | 'title'> // PickProps 具有 Props 的 id 和 title 属性
|