suochantsao / suochantsao.github.io

A Hexo blog for my developer's stuff.
https://suochantsao.github.io/
0 stars 0 forks source link

TypeScript #34

Open suochantsao opened 10 months ago

suochantsao commented 10 months ago
suochantsao commented 9 months ago

Type assertion

suochantsao commented 9 months ago

export type ChannelDataAnother = Omit<ChannelData, 'db'> & { db_id: number } ChannelDataAnother 是一個擴展自 ChannelData 的型別,它去除了 ChannelData 中的 db 屬性,同時新增了一個 db_id 屬性,使得最終型別包含所有原型別屬性以及新的 db_id 屬性。