Error Suppression
บางครั้งต้อง suppress errors แต่ควรใช้อย่างระมัดระวังและมีเหตุผล ไม่ใช่ทางออกหลัก
เมื่อไหร่ควร Suppress
Section titled “เมื่อไหร่ควร Suppress”| Use Case | วิธีที่ถูกต้อง |
|---|---|
| Third-party type bugs | @ts-expect-error พร้อมเหตุผล |
| Legacy code migration | @ts-ignore ชั่วคราว |
| Test invalid inputs | @ts-expect-error |
| Large file migration | @ts-nocheck (temporary) |
เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google