# TypeScript Level 2: Object Types

> Level 2: Object Types of the LoWisa TypeScript course: Interfaces and Type Aliases, Optional and Readonly Properties, Structural Typing. 3 lessons and 9 ideas, each explained in one line.

Object Types is level 2 of 16 of the [LoWisa TypeScript course](/courses/typescript/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Interfaces and Type Aliases

- **interface.** An **interface** names an object shape once so every function can share it: interface User {id: string}.
- **type aliases.** A **type** alias names any type at all: objects, unions, functions: where interface handles objects only.
- **Choosing between them.** Teams pick one habit: interface for object shapes, type for **unions** and compositions: consistency beats doctrine.

## Optional and Readonly Properties

- **Optional properties.** A question mark makes a property **optional**: nickname?: string means present or absent, and the checker enforces the check.
- **readonly.** The **readonly** modifier forbids reassignment after creation, documenting immutability the compiler defends.
- **Honest optionality.** Mark optional only what is truly sometimes absent: optional-everything types push **undefined** checks into every caller.

## Structural Typing

- **Shape over name.** TypeScript types are **structural**: any value with the right properties fits, whatever its declared name.
- **Excess property checks.** Object literals get **excess** property checking: a typoed extra key fails right at the call site.
- **Duck typing, checked.** Structural typing is duck typing with proof: if it has the shape, it **fits**: and the compiler verified the quack.

## Before and after this level

- **Before:** [Level 1: TypeScript Foundations](/courses/typescript/level-1-typescript-foundations/): Primitive Types and Inference, Variables, Functions and Objects, Reading TypeScript.
- **Next:** [Level 3: Unions & Narrowing](/courses/typescript/level-3-unions-and-narrowing/): Union and Intersection Types, Type Guards and Control-Flow Analysis, Discriminated Unions.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does TypeScript Level 2: Object Types cover?

Interfaces and Type Aliases, Optional and Readonly Properties, Structural Typing: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 1: TypeScript Foundations, which covers Primitive Types and Inference, Variables, Functions and Objects, Reading TypeScript.

## Learn TypeScript on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/typescript/level-2-object-types/ · Updated 2026-11-16
