Skip to content
Justice Tech School

Interfaces

An interface describes an object shape and can be extended and implemented by classes.

Example
interface User { id: number; name: string; email?: string }
const u: User = { id: 1, name: "Ada" };
console.log(u);

Result

{
  id: 1,
  name: "Ada",
}

Exercise

Optional property.

email: string

Quiz Test

What does ? after a name mean?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.