TypeScript · Lesson 23 of 120
Interfaces
Describe objects.
Interfaces are another way to name an object type. They look very similar to aliases, without the equals sign. Many teams use them for object shapes.

- Another way
- No equals sign
- Object shapes
A Customer interface
Interface Customer describes a customer, with an optional phone number. Welcome takes any customer. Run it.
app.tstypescript
interface Customer {
name: string;
email: string;
phone?: string;
}
function welcome(c: Customer) {
return `Welcome, ${c.name}! We'll email ${c.email}.`;
}
console.log(welcome({ name: "Priya", email: "priya@example.com" }));Output
Welcome, Priya! We'll email priya@example.com.
Summary
Interfaces describe object shapes, just like aliases. Next, how to choose between them.
Key takeaways- interface Customer
- Optional phone
- Same checks
Next up: Aliases or Interfaces — how to choose