我们可以通过Interface关键字来定义限制数据的类型。
1.给对象定义类型
/*** 定义一种类型,名称叫做PersonInfo,里面有三个属性* name 人物的名字,类型为string* age 人物的年龄,类型为number* say 人物的方法,类型为函数类型&a…
type 与 interface
官方文档是这么说的: For the most part, you can choose based on personal preference, and TypeScript will tell you if it needs something to be the other kind of declaration. If you would like a heuristic, use interface until you…
typescript中interface介绍:TypeScript 中的接口 interface_疆~的博客-CSDN博客通常使用接口(Interface)来定义对象的类型。https://blog.csdn.net/qq_40323256/article/details/128478749
type
type关键字是声明类型别名的关键字。用来给一…