Skip to main content

Practice TypeScript

Scrimba runs TypeScript in the browser player, pause a cast, widen a type, watch the compiler yell, fix it. Pair Learn TypeScript with free JavaScript + React scrims so types meet real components, not toy .ts files.

Who this is for

JS devs who pasted any to ship a feature and now need confidence before the next code review.

TypeScript catches bugs before production; interactive lessons catch misunderstandings before your PR.

Why Practice TypeScript on Scrimba?

Scrimba's interactive format is ideal for TypeScript because:

  1. Pause and edit, stop the video and modify type annotations to see what happens
  2. Instant feedback, see TypeScript errors in real-time as you code
  3. Real projects, build actual applications, not isolated exercises
  4. No setup required, TypeScript runs in the browser, no local toolchain needed

Top Courses to Practice TypeScript

Learn TypeScript

Level: Intermediate | Access: Pro

Master TypeScript fundamentals: types, interfaces, generics, type narrowing, and utility types. Build real applications while learning type safety.

Learn JavaScript

Level: Beginner | Duration: 9 hrs | Access: Free

TypeScript builds on JavaScript. If you're new to both, start here to learn the language fundamentals before adding types.

Learn React

Level: Intermediate | Duration: 15.1 hrs | Access: Free

Modern React projects increasingly use TypeScript. Learn React fundamentals first, then apply TypeScript to your React components.

TypeScript Practice Exercises

Exercise 1: Type a User Object

// Start with this JavaScript and add types:
const user = {
name: "Alice",
age: 30,
email: "[email protected]",
isActive: true,
};

Practice defining interfaces, optional properties, and readonly modifiers.

Exercise 2: Generic Functions

// Make this function work with any type:
function getFirst(items) {
return items[0];
}

Generics are one of TypeScript's most powerful features. Practice using <T> to create flexible, type-safe functions.

Exercise 3: Union Types for API Responses

// Type this API response handler:
function handleResponse(response) {
if (response.status === "success") {
return response.data;
} else {
throw new Error(response.error);
}
}

Discriminated unions teach you how TypeScript narrows types based on conditions, essential for real API work.

How to Practice Effectively

  1. Start with JavaScript you know, take existing JS code and add types incrementally
  2. Use strict mode, "strict": true in tsconfig.json forces you to handle edge cases
  3. Read the errors, TypeScript errors are verbose but informative. Learn to read them
  4. Build something real, a todo app, an API client, or a CLI tool in TypeScript

Use this guide when…

You are past syntax tutorials and need typed React + API code without fighting your local tsconfig first.

Write TypeScript inside scrims

Solidify JS on free courses, then add Pro for Learn TypeScript + paths.

Try Scrimba free (opens in a new tab)