Codington

TypeScript exercises

Free browser exercises with instant feedback, from beginner to advanced.

Teaching TypeScript? Use with your class

0 of 94 exercises completed

0%
No account needed · Progress saved in this browser
Start practising

Part 1

TypeScript Foundations

Start with core types, typed functions, object shapes, and arrays.

Beginner · 4 topics

Topic 1

Primitives

TypeScript builds on JavaScript by adding types, so we can describe exactly what kind of values a variable

0 of 5 completed
Start
Topic 2

Functions Basics

Functions are how we structure behavior. In TypeScript, you can describe parameter types and return types so

0 of 6 completed
Start
Topic 3

Object Types Basics

Objects model real-world entities. In TypeScript, you describe an object's shape by listing its properties

0 of 6 completed
Start
Topic 4

Arrays

Arrays are ordered lists of values written as T[] or Array<T>: `typescript const numbers: number[] = [1, 2,

0 of 6 completed
Start

Part 2

Modeling Data

Describe possible values and reusable data shapes with unions, aliases, interfaces, and null safety.

Beginner · 4 topics

Topic 5

Union & Literal Types

Union types let a value be one of several possibilities, while literal types restrict values to exact

0 of 5 completed
Start
Topic 6

Type Aliases

Type aliases give a name to any type so you can reuse it throughout your code: `typescript type UserId =

0 of 6 completed
Start
Topic 7

Interfaces

Interfaces describe the shape of an object: `typescript interface User { id: number; name: string; email?:

0 of 6 completed
Start
Topic 8

null & undefined

When strict null checks are on, null and undefined must be handled explicitly. This helps you avoid crashes

0 of 6 completed
Start

Part 3

Safe and Reusable Code

Handle uncertain values safely, narrow types, and write reusable generic code.

Intermediate · 4 topics

Topic 9

Type Assertions

Type assertions tell TypeScript how to treat a value. They do not change runtime behavior—they only affect

0 of 6 completed
Start
Topic 10

any (vs unknown)

any turns off type checking completely. It spreads quickly through your code and hides bugs. Prefer unknown

0 of 6 completed
Start
Topic 11

Type Guards & Narrowing

Type guards help the compiler figure out which shape a value has at a given point. When a check succeeds,

0 of 6 completed
Start
Topic 12

Generics Fundamentals

Generics let you write components that work over many types without losing type safety: `typescript function

0 of 5 completed
Start

Part 4

Advanced Type Patterns

Combine function signatures, utility patterns, object types, and indexed access for larger programs.

Advanced · 4 topics

Topic 13

Functions: Call Signatures & Overloads

Functions are the heart of TypeScript programs. You can describe a function's shape with a call signature:

0 of 6 completed
Start
Topic 14

Creating Types from Types (Utility Patterns)

Utility types help you reshape and remix existing types without rewriting them: `typescript type User = { id:

0 of 7 completed
Start
Topic 15

Object Types (Deep Dive)

This deep dive builds on basic object types with advanced patterns: Intersections – Combine multiple types

0 of 6 completed
Start
Topic 16

keyof, typeof & Indexed Access

This category links runtime values to static types using powerful type operators: keyof – Get all property

0 of 6 completed
Start