interface A {
name: string;
sex: number;
}
interface B {
age: number;
sex: number;
}
type C = A&B
let c:C = { name: 'xxx', age: 18, sex: 1 }
既是A的子类型,又是B的子类型,既要满足A又要满足B
type AA = string | number;
type BB = string | boolean;
type CC = AA & BB;
那么CC是string类型