NemoZhong / blog-nemo

0 stars 0 forks source link

ts问题 #31

Open NemoZhong opened 8 months ago

NemoZhong commented 8 months ago

记录一些ts中遇到的问题,及一些type-challenges

NemoZhong commented 8 months ago

其他 type和interface的区别

// 扩展属性:
type A = {
    name: string
}
interface B {
    age: number
}

type M = A & B & {}
interface N extends A,B {}

const c: M = { name: '23', age: 23 }
const d: N = { name: '23', age: 23 }