Lesson 3 of 5

Interfaces & types

Interfaces & types

Describe object shapes with interface or type:

type User = { name: string; age: number };

Now the compiler enforces that every User has those fields.

Q&A · 0

Enrol to ask questions and join the discussion.

No questions yet — be the first to ask.