Understanding TypeScript Intersection Types - A Comprehensive Guide

Lets imagine that we need to model different types with common properties.

At first without using intersection types you will have following type definitions.

type Conference = {
 title: string,
 description: string,
 location: string,
 talks: string[]
}
type Webinar = {
 title: string,
 description: string,
 invationLink: string,
 talks: Talk
}

But it is possible to define a base type and use intersection types to define new types.

type TalkBase = {
 title: string,
 description: string,
}
type Conference = TalkBase & {
 location: string,
 talks: string[]
}
type Webinar = TalkBase & {
 invationLink: string,
 talks: Talk
}