

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Interfaces
incomplete
2: Extending Interfaces
incomplete
3: Extending Multiple Interfaces
incomplete
4: Overriding Interface Properties
incomplete
5: Declaration Merging
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
You can override properties from the base interface, but the new type must be compatible with the original:
interface Character {
rank: string | number;
name: string;
level: number;
}
interface Wizard extends Character {
// Wizards only have a number rank
// This is allowed because
// `number` is assignable to `string | number`
rank: number;
mana: number;
}
But you can't change to an incompatible type:
interface Character {
rank: string;
name: string;
level: number;
}
interface Wizard extends Character {
// This breaks because `number` is
// not assignable to `string`
rank: number;
mana: number;
}
The company uses a shared SystemEvent interface to represent internal system events. We need more specific system event interfaces for handling errors and outages as well as a way to filter for the high-priority events.