[推薦] 6 Advanced TypeScript Tricks
Source
https://medium.com/@mvsg/6-advanced-typescript-tricks-for-clean-code-90cee774dbf3 10min
Summary
分別羅列以下幾種方式
- Advanced Types: Mapped Types & Conditional Types
- Decorators: Class、Method、Property & Parameter Decorators
- Namespaces: grouping related code
- Mixins: compose classes, not inheritance, kind like trait in PHP
- Type Guards: use
is
keyword on function parameters, then caller can use dot notation - Utility Types:
Partial
,Pick
,Readonly
,Omit
發佈時間
2023-5-4