let age: number=18//变量定义

const fun=(msg:string):string=>{}//方法定义

interface Cat {//接口定义
    name: string,
    age?: number//? age属性是可选的
}
const c1: Cat = {name: 'jack', age: 1}

class User {//定义类,类可以实现接口和继承类
    name: string
    constructor(name: string) {//构造方法
        this.name = name
    }
    study() {
        console.log(this.name + '正在学习')
    }
}
const user = new User('jack')
console.log(user)
user.study()