定义接口
interface IPerson {
firstname: string,
lastname: string,
sayHi:()=>string
}
//实现接口
let customer: IPerson = {
firstname: 'zhang',
lastname: 'shang',
sayHi: ():string => { return "hi" }
}
console.log(customer.firstname)
console.log(customer.sayHi())
网友评论