What is TypeScript?
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. It adds optional static typing and class-based object-oriented programming.
Why TypeScript?
- Catch errors early: Find bugs at compile time, not runtime
- Better tooling: Improved autocomplete, refactoring, and navigation
- Self-documenting: Types serve as documentation
- Scalable: Easier to maintain large codebases
Your First TypeScript Program
Type Annotations
In TypeScript, you can add type annotations to variables:
Compilation
TypeScript compiles to JavaScript. Click "Show JS" to see the output:
The types are removed during compilation - they're only for development!
Exercise: Add Types
Add type annotations to the variables:
Up next · Lesson 2 of 34
Your First Types
1 min read
1 of 34 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

