1. interface 和 type 都可以用来描述 object 或者 function 的类型 ```typescript interface Person { name: string age: number }

    interface SetPerson { (k: string, v: string): void }

    type Person = { name: string age: number }

    type SetPerson = (k: string, v: string) => void

    1. 2. 区别于interface type可用于其他类型, 例如 primitives unions tuples
    2. ```typescript
    3. // primitive[原始数据类型]
    4. // boolean string number bigint symbol undifined numm void 枚举类型 字面量类型
    5. type name = string
    6. // object
    7. type AgeX = {x: number}
    8. type AgeY = {y: number}
    9. // union
    10. type Age = AgeX | AgeY
    11. // tuple
    12. type Age = [number, string]
    1. 两者都可以扩展,且相互不排斥 ```typescript // 同类型扩展 interface PartialPointX { x: number }

    interface Point extends PartialPointX { y: number }

    // 相当于 // interface Point { // x: number // y: number // }

    type PartialPointX = { x: number } type Point = PartialPointX & { y: Number }

    // 相当于 // type Point = { // x: number // y: number //}

    // 互相扩展 type -> interface type PartialPointX = { x: number } interface Point extends PartialPointX { y: number }

    // 互相扩展 interface -> type interface PartialPointX { x: number } type Point = PartialPointX & { y: Number }

    ```