# typescript 中 interface 与 type 有何区别
Issue
欢迎在 Gtihub Issue 中回答此问题: Issue 730 (opens new window)
Author
https://stackoverflow.com/questions/37233735/interfaces-vs-types-in-typescript
Author
interface 是接口,type 是类型,本身就是两个概念。只是碰巧表现上比较相似。 希望定义一个变量类型,就用 type,如果希望是能够继承并约束的,就用 interface。 如果你不知道该用哪个,说明你只是想定义一个类型而非接口,所以应该用 type。
Author
interface 和 type 都可以用来声明和约束变量类型结构,interface 可以被继承重载,type 要想被继承只能使用联合&,而且 interface 的性能比 type 更好