Imagine I have these two different interfaces:
interface Bird {
type: 'bird';
flyingSpeed: number;
}
interface Horse {
type: 'horse';
runningSpeed: number;
}
Now, the challenge is to create a new interface that extends either the Bird
or Horse
interface. It's known that this can be achieved by using the type keyword. The question arises if it's possible to do so using an interface instead, like this:
interface Animal extends Bird | Horse {
name: string
}