1. Concept library
  2. JavaScript & TypeScript
  3. Module 3: Objects, interfaces, unions

Concept

Interfaces and type aliases

Both describe the shape of an object. interface can be extended and merged; type can also name unions, tuples and functions. Pick one style per codebase and use it consistently.

What a session covers

The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.

  1. Explain what interface and type can each describe and where they differ
  2. Write an interface for an object shape and extend it
  3. Explain why a type does not check data at runtime

In practice

A few lines that show Interfaces and type aliases doing its job.

TypeScript
interface User {
  id: string;
  name: string;
  email?: string;
}

interface Admin extends User {
  permissions: string[];
}

type UserId = User["id"];
type Pair = [User, Admin];

The common mistake

Watch for

Assuming an interface checks the object at runtime. Types vanish when the code compiles; data from a network or a file still needs a runtime check before you trust its shape.

What to know first

Your roadmap puts these before Interfaces and type aliases, unless you already know them.

How it stays learned

Once a session shows you understand Interfaces and type aliases, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.

  1. Day 3First recall, while it is fresh
  2. Day 7Second, a week on
  3. Day 18Last, when it has settled

Where it leads

Topics that build on Interfaces and type aliases.

Next in the moduleUnion types →