typescript 的動態新增物件屬性


Oct 03, 2022

今天遇到一個問題,有一個物件會依據收到的資料去新增屬性,可以利用這段語法達到想要的效果。

interface Dividend {
    [key: string]: DividendState[]
}
#nodejs #node.js #js #ts #TypeScript






你可能感興趣的文章

跳出迴圈的方法 continue, break 與 return

跳出迴圈的方法 continue, break 與 return

[1] Python 3 簡介與安裝

[1] Python 3 簡介與安裝

用toObject()取代lean() -TypeError: lean is not a function

用toObject()取代lean() -TypeError: lean is not a function






留言討論






2
2
2