
typescript
玐也很可爱呀
这个作者很懒,什么都没留下…
展开
-
typescript中的接口
属性类接口 对json的约束 //传入的对象必须含有info这个字段 function print(label: {info:string}):void{ console.log(label) } //print('sd') //error print({info:'ds'})原创 2021-01-28 14:40:37 · 242 阅读 · 0 评论 -
typescript中的类
1.类的定义 其实在es5中也有关于类的写法,常规定义 function Person(name){ this.name = name this.getName = function(){ console.log(this.name) } } let p = new Person('zs') console.log(p.name) //zs p.getName() //zs 在ts中定义类的写法 class Person{ name:string;原创 2021-01-26 08:56:24 · 278 阅读 · 0 评论