Menu
Coddy logo textTech

What is TypeScript?

Part of the Introduction To TypeScript section of Coddy's JavaScript journey — lesson 1 of 73.

TypeScript is a programming language developed by Microsoft that builds on JavaScript by adding static types. Think of it as JavaScript with an extra layer of safety and tooling.

The key concept to understand is that TypeScript is a superset of JavaScript. This means that any valid JavaScript code is also valid TypeScript code. You can take any existing JavaScript file, rename it from .js to .ts, and it will work in TypeScript.

What makes TypeScript special is that it adds type annotations on top of JavaScript. These annotations allow you to specify what kind of data your variables should hold - whether they're strings, numbers, objects, or other types. This helps catch potential errors before your code even runs.

// JavaScript (also valid TypeScript)
let message = "Hello World";

// TypeScript with type annotation
let message: string = "Hello World";

TypeScript provides better development tools, improved code readability, and helps prevent common programming mistakes that might otherwise only be discovered when your application is running.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

Cheat sheet

TypeScript is a superset of JavaScript that adds static types. Any valid JavaScript code is also valid TypeScript code.

TypeScript adds type annotations to specify what kind of data variables should hold:

// JavaScript (also valid TypeScript)
let message = "Hello World";

// TypeScript with type annotation
let message: string = "Hello World";

TypeScript files use the .ts extension instead of .js.

Try it yourself

This lesson doesn't include a code challenge.

quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Introduction To TypeScript