TypeScript
非著名奶茶爱好者
欢迎大家交流~
展开
-
TypeScript - 基本数据类型
布尔型数字型字符串型数组型元组型枚举型any型void型object型联合型(()=>{ // 1.布尔型 let flag:boolean = true console.log(flag) // 2.数字型 let num:number = 100 console.log(num) // 3.字符串型 let str:string = 'hello' console.log(str) // .原创 2021-04-22 19:06:26 · 94 阅读 · 0 评论 -
TypeScript - 继承和接口
先定义接口定义类实现接口类可以实现多个接口接口可以继承其他接口// 定义一个接口interface IFly { fly()}interface ISwim { swim()}// 定义一个类,这个类实现接口class Person1 implements IFly { fly() { console.log('I can fly!') }}const zs = new Person1()zs.fly()// 定义一个类,实.原创 2021-04-22 22:09:39 · 177 阅读 · 0 评论