ENع
الدرس 08 · Core type system

Type aliases vs interfaces

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

TypeScript has two ways to name a type: type, which makes a type alias, and interface. Watch tsc read both in one file: an alias naming the union number | string, an interface Pet declared twice and merged, and Dog built with extends. tsc uses the shape it builds to catch a Dog with no age, then erases every type and the program prints Rex 3.

10 دقيقة8 خطوات5 أسئلةIntermediate
شكل 8 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.