标签:int type strong ring mic esc bsp var class
当交叉类型的多个类型发生冲突时,例如:
冲突的属性类型会变为交叉类型,上例中的属性name会变为:string & number,鉴于string & number属性太过少见,已下例为示:
interface ia { name: {attr1: string}; } interface ib { name: {attr2: number}; age: number; } type a= ia & ib; var s:a= {name: {attr1: ‘11‘,attr2: 22},age: 16} console.log(s)
标签:int type strong ring mic esc bsp var class
原文地址:https://www.cnblogs.com/yanze/p/12298274.html