---
title: "Discussion on \"TIL: Difference between Omit and Exclude in TypeScript\" | Hashnode"
description: "Discussion on \"TIL: Difference between Omit and Exclude in TypeScript\". I was trying to use Omit utility type to create a mapped type and it was giving me an error. Please consider the example below.\nThe Problem\nI have a type with union literals like this\ntype something = 'abc' | 'bcd' | 'cde' | 'def';\n\nI wanted to creat..."
url: "https://hashnode.com/posts/difference-between-omit-and-exclude-in-typescript/60b61b60f4a8435c0ecc4070"
---

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

Discussion

# [TIL: Difference between Omit and Exclude in TypeScript](https://iamshadmirza.hashnode.dev/difference-between-omit-and-exclude-in-typescript?utm_source=hashnode&utm_medium=feed)

I was trying to use Omit utility type to create a mapped type and it was giving me an error. Please consider the example below. The Problem I have a type with union literals like this type something = 'abc' | 'bcd' | 'cde' | 'def'; I wanted to creat...

Jun 1, 2021 · 3 min read · iamshadmirza.hashnode.dev  
Updated Aug 6, 2022  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Shad Mirza](https://hashnode.com/@iamshadmirza)

@iamshadmirza · Bengaluru, India

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

Building Hashnode

A JavaScript enthusiast and a creator who knows how to use Keyboard, Pen, Pencil, and Gamepad to their fullest.

## Responses 4

Markdown supported · ⌘↵ to post

[Yolo man](https://hashnode.com/@Heisenberg62)

[Dec 15, 2023](https://hashnode.com/posts/difference-between-omit-and-exclude-in-typescript/60b61b60f4a8435c0ecc4070/comment/657c3ffbf7ee9350b5c5b793)

This is helpful!

[yanliang shang](https://hashnode.com/@syl)

[Apr 27, 2022](https://hashnode.com/posts/difference-between-omit-and-exclude-in-typescript/60b61b60f4a8435c0ecc4070/comment/62696f13aedfbdb0ce1a61dc)

I think it's the reason for **keyof**

You can try running the following code

```
type A='a' | 'b' | 'c' | 'd'
type C =keyof  A;
```

[Shradha Singh](https://hashnode.com/@shradha)

[Feb 13, 2022](https://hashnode.com/posts/difference-between-omit-and-exclude-in-typescript/60b61b60f4a8435c0ecc4070/comment/62089f7385b93114aeba46fa)

Helpful 👍

[Girish Patil](https://hashnode.com/@evilhead)

[Jun 21, 2021](https://hashnode.com/posts/difference-between-omit-and-exclude-in-typescript/60b61b60f4a8435c0ecc4070/comment/60d0519307db7a50332c0b9b)

Nice one shad

[Shad Mirza](https://hashnode.com/@iamshadmirza)

[Jul 14, 2022](https://hashnode.com/posts/difference-between-omit-and-exclude-in-typescript/60b61b60f4a8435c0ecc4070/comment/60d0519307db7a50332c0b9b#reply-62cfc86085db46d9da370e58)

Thanks Girish
