Is there a way to ensure that an interface extends from another interface in TypeScript?
For example:
export interface Configuration {
pages: {
home: IHome;
about: IAbout; // How can we make IAbout extend IPage?
contact: IPage;
};
}
interface IPage {
displayName: string;
}
interface IHome extends IPage {
slider: any; // Unique property for Home
}
interface IAbout { // How can we enforce this interface to extend IPage like IHome does?
map: any; // Unique property for About
}
How can we force IAbout
to extend IPage
?
The method [pageName: string]: IPage
doesn't guarantee that it will extend IPage
.
Is there a method to mandate that the values inherit properties from IPage
?