Skip to content
Justice Tech School

Extending Interfaces

Interfaces extend others to add properties without repeating them.

Example
interface Animal { name: string }
interface Dog extends Animal { bark(): string }
const d: Dog = { name: "Rex", bark: () => "woof" };
console.log(d.name, d.bark());

Result

Rex woof

Exercise

Inherit shape.

interface B  A {}

Quiz Test

What does extends do on interfaces?

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