WeCodeAcademy

What is TypeScript?

TypeScript is JavaScript plus types. A type says what kind of value something holds, such as a number or some text. The compiler checks your code before it runs and catches mistakes, like adding a number to the word "apple", while you are still writing.

When you press Run on this site, your code is type-checked first. If it is fine, the types are removed and the JavaScript runs. (The first Run downloads the TypeScript compiler, so it takes a moment.)

Exampletypescript
Open in editor »

The : string and : number parts are type annotations. Now break it on purpose: change 2026 to "soon" and Run again. TypeScript refuses and tells you why.

Exampletypescript
Open in editor »
Quick check

When does TypeScript check your types?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.