Guided Notes

Interfaces

Declaring object contracts with interface, extending interfaces, declaration merging, interfaces for functions, and when to use interface vs type.

Declaring an interface

Slide 1 / 4

interface Employee { id: number; name: string; department: string; manager?: Employee; }

An interface describes the shape an object must have. Any object with those properties (and compatible types) satisfies it β€” TypeScript uses structural typing: what matters is the shape, not the name.

← Object Types & Type Aliases