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

Assertion Functions

Assertion Functions ช่วย narrow types โดยการ throw error ถ้าเงื่อนไขไม่ตรง ต่างจาก type guards ตรงที่ไม่ return boolean

FeatureType GuardAssertion
Returnsbooleanvoid (หรือ throws)
Syntaxis Tasserts
Use caseif/elsevalidate หรือ crash
Diagram

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

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