For the complete documentation index, see llms.txt. This page is also available as Markdown.

type和interface的区别

interface

  1. interface 只能用于定义对象类型

  2. interface 方式可以实现接口的 extends 和 implements

  3. interface 可以实现接口合并声明

type

type 的声明方式除了对象之外还可以定义交叉、联合、原始类型等,类型声明的方式适用范围显然更加广泛。

最后更新于