Skip to content
เข้าสู่ระบบ

satisfies Operator

satisfies operator (TypeScript 4.9+) ช่วยตรวจสอบว่าค่าตรงกับ type ที่กำหนด โดยไม่ทำให้สูญเสีย inferred types เหมือนการใช้ type annotation

วิธีType SafetyInference
No annotationไม่มีเต็มที่
Type annotationเต็มที่สูญเสีย
satisfiesเต็มที่เก็บไว้
Diagram

เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม

ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด