satisfies Operator
satisfies operator (TypeScript 4.9+) ช่วยตรวจสอบว่าค่าตรงกับ type ที่กำหนด โดยไม่ทำให้สูญเสีย inferred types เหมือนการใช้ type annotation
เปรียบเทียบ
Section titled “เปรียบเทียบ”| วิธี | Type Safety | Inference |
|---|---|---|
| No annotation | ไม่มี | เต็มที่ |
| Type annotation | เต็มที่ | สูญเสีย |
| satisfies | เต็มที่ | เก็บไว้ |
satisfies Flow
Section titled “satisfies Flow”เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google