typescript
- Exclude<T, U>,T有,U没有
type ResT = Exclude<"a"|"b"|"c", "c"|"d">
// ResT = "a"|"b"
- Extract<T, U>,T、U交集
type ResT = Extract<"a"|"b"|"c", "c"|"d">
// ResT = "c"
- Pick<T, K>,从T中取出K
ExampleTyle = {
lable: string
id: string
}
const ResT = Pick<ExampleTyle, 'lable'>
// ResT = {label: string}
- Omit<T, K>,从T中去除K
ExampleTyle = {
id: string
lable: string
name: string
}
const ResT = Omit<ExampleTyle, 'lable'>
// ResT = {
// id: string
// name: string
// }