<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/typescript---tips-tricks---union-and-intersection-fm1evmztr" -->

---
title: Typescript - Tips &amp; Tricks - Union and Intersection
description: A brief introduction to TypeScript&#x27;s Union (|) and Intersection (&amp;) types. Union types allow a value to be one of several types, with the compiler only...
canonical: https://daily.dev/posts/typescript---tips-tricks---union-and-intersection-fm1evmztr
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Typescript - Tips &amp; Tricks - Union and Intersection | daily.dev
og:description: A brief introduction to TypeScript&#x27;s Union (|) and Intersection (&amp;) types. Union types allow a value to be one of several types, with the compiler only...
og:url: https://daily.dev/posts/typescript---tips-tricks---union-and-intersection-fm1evmztr
og:image: https://api.daily.dev/og/posts/FM1eVMztR.png
og:image:alt: Typescript - Tips &amp; Tricks - Union and Intersection
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Typescript - Tips & Tricks - Union and Intersection

**[Playful Programming](https://daily.dev/sources/playfulprogramming)** · [@puppo](https://daily.dev/puppo) · 2 min read · 0 upvotes · 0 comments

## Summary

A brief introduction to TypeScript's Union (|) and Intersection (&) types. Union types allow a value to be one of several types, with the compiler only exposing properties common to all members. Intersection types combine multiple types into one, merging all their properties. Short code examples illustrate both concepts.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://playfulprogramming.com/posts/typescript-tips-tricks-union-and-intersection-1a9l>

## Similar posts on daily.dev

- [Visual Types](https://daily.dev/posts/visual-types-yqneyg40x) · Lobsters · 5 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#typescript](https://daily.dev/tags/typescript)

[View this post on daily.dev](https://daily.dev/posts/typescript---tips-tricks---union-and-intersection-fm1evmztr)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Typescript - Tips & Tricks - Union and Intersection","url":"https://daily.dev/posts/typescript---tips-tricks---union-and-intersection-fm1evmztr","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/typescript---tips-tricks---union-and-intersection-fm1evmztr"},"datePublished":"2026-03-16T21:46:42.154Z","dateModified":"2026-03-17T18:01:05.788Z","description":"A brief introduction to TypeScript's Union (|) and Intersection (&) types. Union types allow a value to be one of several types, with the compiler only...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ce2cd559ac6110017e09c91b369d7b6d?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ce2cd559ac6110017e09c91b369d7b6d?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Playful Programming","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Luca Del Puppo","url":"https://daily.dev/puppo","image":"https://avatars.githubusercontent.com/u/2527849?v=4","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":980}},"commentCount":0,"discussionUrl":"https://daily.dev/posts/typescript---tips-tricks---union-and-intersection-fm1evmztr","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,typescript","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Playful Programming","item":"https://daily.dev/sources/playfulprogramming"},{"@type":"ListItem","position":3,"name":"Typescript - Tips & Tricks - Union and Intersection"}]}
```

