In the previous section, we mentioned union types but haven't covered them as yet. Let's fix that right away – it will only be a small detour and will prove very useful later on!
Union types allow us to define new types by joining existing ones together using the | (pipe) character. When you use a union type, you can only access the members that are common to all those types in the union.
A great example is that you can use a union instead of any to indicate that you accept either one type or the other:
interface BoardGame { name: string; description: string; minimalAge: number; players: string; duration: string; } interface VideoGame { name: string; description: string; minimalAge: number; players: string; online: boolean; } function displayGame(game: VideoGame | BoardGame...