# typescript
- Exclude<T, U>,T有,U没有
type ResT = Exclude<"a"|"b"|"c", "c"|"d">
// ResT = "a"|"b"
1
2
2
- Extract<T, U>,T、U交集
type ResT = Extract<"a"|"b"|"c", "c"|"d">
// ResT = "c"
1
2
2
- Pick<T, K>,从T中取出K
ExampleTyle = {
lable: string
id: string
}
const ResT = Pick<ExampleTyle, 'lable'>
// ResT = {label: string}
1
2
3
4
5
6
2
3
4
5
6
- Omit<T, K>,从T中去除K
ExampleTyle = {
id: string
lable: string
name: string
}
const ResT = Omit<ExampleTyle, 'lable'>
// ResT = {
// id: string
// name: string
// }
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
← rabbitMQ vuepress搭建 →