TS - Intersection
Last updated
Last updated
TypeScript မှာ Intersection (&)
Operator ကို Type တွေကို ပေါင်းစပ် (combine) လုပ်ဖို့သုံးပါတယ်။ Type နှစ်ခု (သို့မဟုတ် ပိုများတဲ့ Type) ကို ပေါင်းစပ်ပြီး အားလုံးရဲ့ property တွေ ပါဝင်တဲ့ Type အသစ်တစ်ခု ဖန်တီးနိုင်ပါတယ်။
Code ကို တစ်ချက် လေ့လာကြည့်ပေးပါ ။
People
Type နဲ့ AdminRole
Type ကို (&)
နဲ့ ပေါင်းစပ်လိုက်တာပဲ ဖြစ်ပါတယ် ။
ဒါဆိုရင် Admin
Type အသစ်မှာ properties အားလုံးကို လက်ခံရရှိသွားမှာပါ ။