To extend types in TypeScript, we can use the extends keyword.
For instance, we write
type Event = {
  name: string;
  dateCreated: string;
  type: string;
};
interface UserEvent extends Event {
  UserId: string;
}
to create the UserEvent interface that extends the Event type.
We extend it by adding the string UserId field in UserEvent and inheriting the rest from Event.
Conclusion
To extend types in TypeScript, we can use the extends keyword.
