ts接口以及实例化

    interface Person{
        name:string
        age:number
    }

    function sayhi(p:Person){
        console.log(p.name+" : "+p.age)
    }
    let p={
        name:'daye',
        age:18
    }
    console.log(sayhi(p))

 

posted @ 2024-07-24 22:10  关键步就几步  阅读(12)  评论(0编辑  收藏  举报