Type Predicates
Type Predicates ช่วยสร้าง custom type guards ที่ TypeScript เข้าใจ ทำให้ narrow types ได้ในจุดที่ built-in guards ทำไม่ได้
Type Predicate Syntax
Section titled “Type Predicate Syntax”function isType(value: unknown): value is Type { // return boolean}เข้าสู่ระบบเพื่อดูเนื้อหาเต็ม
ยืนยันตัวตนด้วยบัญชี Google เพื่อปลดล็อกบทความทั้งหมด
Login with Google