Destructuring Types
Destructuring ใน TypeScript ต้องใส่ type annotations อย่างถูกต้อง syntax อาจ confusing แต่เรียนรู้แล้วจะสะดวกมาก
Destructuring Types
Section titled “Destructuring Types”| Pattern | Example |
|---|---|
| Object | { a, b }: { a: T; b: U } |
| Array | [a, b]: [T, U] |
| Nested | { a: { b } }: { a: { b: T } } |
| Default | { a = default }: { a?: T } |
เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google