---
title: "Discussion on \"Union Vs Intersection in ts\" | Hashnode"
description: "Discussion on \"Union Vs Intersection in ts\". Union - |\nUnion acts like the unions in Set type:A = {1,2,3}B = {4,5}AUB = {1,2,3,4,5}\nSo in terms of Typescript:\ninterface Person {\n name: string;\n}\ninterface Lifespan {\n birth: Date;\n death?: Date;\n}\n\ntype unionCheck = Person | Lifespan\n\n// Can tak..."
url: "https://hashnode.com/posts/union-vs-intersection-in-ts/695f623fec50a4f53fd5f409"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Union Vs Intersection in ts](https://tslearnings.hashnode.dev/union-vs-intersection-in-ts?utm_source=hashnode&utm_medium=feed)

Union - | Union acts like the unions in Set type:A = {1,2,3}B = {4,5}AUB = {1,2,3,4,5} So in terms of Typescript: interface Person { name: string; } interface Lifespan { birth: Date; death?: Date; } type unionCheck = Person | Lifespan // Can tak...

Jan 8 · 2 min read · tslearnings.hashnode.dev  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#union-type](https://hashnode.com/tag/union-type)
-   [#intersection-types](https://hashnode.com/tag/intersection-types)

## Written by

[Md Affan Aslam](https://hashnode.com/@affan24)

@affan24

  
[View profile](https://hashnode.com/@affan24)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
