1.Required<类型>,能把对象的所有的可选类型项都变为必选类型项
2.Pick:type Pick<T, K extends keyof T> = { [P in K]: T[P];
把泛型T, 提取出T的部分类型 ,和定义的类型结合。
type ProfileParams = Pick<ProfileDetail, 'nickname' | 'gender' | 'birthday' | 'profession'> & {
provinceCode: string,
cityCode: string,
countyCode: string
}
enum
enum SkuMode {
Both = 1,
Cart = 2,
Buy = 3
}
能够声明语义的定义类型,比如 <1 | 2 | 3>这样的类型经过enum定义,就有了语义。