Type Erasure
TypeScript types จะถูก “erase” ตอน compile เป็น JavaScript ไม่มี types ที่ runtime นี่คือ design decision สำคัญที่ต้องเข้าใจ
Type Erasure คืออะไร
Section titled “Type Erasure คืออะไร”| Compile Time | Runtime (JavaScript) |
|---|---|
| Types checked | Types removed |
| Generics resolved | Generics gone |
| Interfaces exist | Interfaces removed |
| Errors caught | No overhead |
เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google