---
title: "Discussion on \"Generating Union Types from a Bijective Map Using Typescript's  Const Assertion\" | Hashnode"
description: "Discussion on \"Generating Union Types from a Bijective Map Using Typescript's  Const Assertion\". In this post, I explore a handful of TypeScript features to create Union types from a Bijective Map and use them to restrict what value (not just type) the keys can take when sending data object to Google Analytics. \nAs a recap, two sets are describe..."
url: "https://hashnode.com/posts/generating-union-types-from-a-bijective-map-using-typescripts-const-assertion/5e34a69cfc003cfb0c64324b"
---

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

Discussion

# [Generating Union Types from a Bijective Map Using Typescript's Const Assertion](https://hashnode.blainegarrett.com/generating-union-types-from-a-bijective-map-using-typescripts-const-assertion?utm_source=hashnode&utm_medium=feed)

In this post, I explore a handful of TypeScript features to create Union types from a Bijective Map and use them to restrict what value (not just type) the keys can take when sending data object to Google Analytics. As a recap, two sets are describe...

Jan 31, 2020 · 12 min read · hashnode.blainegarrett.com  
Updated Jul 15, 2020  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#analytics](https://hashnode.com/tag/analytics)
-   [#nodejs](https://hashnode.com/tag/nodejs)

## Written by

[Blaine Garrett](https://hashnode.com/@blainegarrrett)

@blainegarrrett · Minneapolis, Minnesota, USA

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

Software Engineer and Artist

I&#39;ll find something good to put here.

## Responses 1

Markdown supported · ⌘↵ to post

[Blaine Garrett](https://hashnode.com/@blainegarrrett)

[Feb 1, 2020](https://hashnode.com/posts/generating-union-types-from-a-bijective-map-using-typescripts-const-assertion/5e34a69cfc003cfb0c64324b/comment/5e34c5c88a805c490b5a8ae8)

While putting this all together, I was wondering about the difference between TypeScripts' const assertions and Object.freeze() Here is a good article on the topic. [sitepoint.com/compile-time-immutability-in-typesc…](https://www.sitepoint.com/compile-time-immutability-in-typescript/)
