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.
 
 
 
 
 

21 lines
414 B

// 交叉类型:功能类似 extends,用于组合多个类型为一个类型(常用于对象类型)
interface Person {
name: string
say(): number
}
interface Contact {
phone: string
}
// PersonDetail 同时具有 Person 和 Contact 的属性和方法
type PersonDetail = Person & Contact
let obj: PersonDetail = {
name: 'jack',
phone: '123456',
say() {
return 1
}
}