Index Signatures
Index Signatures ช่วยให้สร้าง types สำหรับ objects ที่ไม่รู้ชื่อ keys ล่วงหน้า แต่รู้ type ของ keys และ values
รูปแบบ Index Signatures
Section titled “รูปแบบ Index Signatures”| รูปแบบ | Syntax | ใช้สำหรับ |
|---|---|---|
| String Index | [key: string]: T | Dynamic string keys |
| Number Index | [key: number]: T | Array-like objects |
| Symbol Index | [key: symbol]: T | Symbol keys |
Index Signature Flow
Section titled “Index Signature Flow”เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google