自己接觸 Typescript 也有一小段時間了,現在做專案傾向能用 TS 就會盡量上 TS,就連平常的小練習,也都讓自己多去使用 TS 來寫。
最近在看一些 NestJS 的介紹,看到了 decorators 裝飾器這玩意。記得之前在 Vue2 使用 Typescript 的相關文章也看到過,不過 Vue3 似乎捨棄了裝飾器的寫法,所以當時就沒有太深入研究。
先介紹一下何謂 Function Overload (函式超載)。
這篇是對之前 po 過的文章做拆分,單獨發出來,不然原本單篇好像太長了,而且這樣 title 也比較好取名。(笑)