Deep dive into enums, const assertions and union types

Typescript is a useful value addition to the JavaScript world. JavaScript can produce unexpected bugs at runtime because of the flexibility it offers. Typescript helps to catch these bugs at an early stage and save us from such headaches. Introducing this additional complexity with static typing does have enormous benefits when used in the right way.

By the right way, I mean, Typescript come with several sources of “unsoundness” with features like any, unknown, type assertionsetc. It is necessary to understand how the types work…