ENع
الدرس 03 · Typing JavaScript

Type inference

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

You do not have to write a type on every variable. Follow a five-line file with no types written at all as tsc, the TypeScript checker, works out each one from its starting value: count and total are numbers, label is a string, and the const unit gets the exact type "kg". Then watch the type it inferred catch count = "three" before the program runs.

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

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