Stefan Baumgartner 11/19/2020

Tidy TypeScript: Prefer union types over enums

Read Original

This article explains why union types are preferable to enums in TypeScript. It highlights that enums emit extra JavaScript code, increasing bundle size, and that numeric enums are not type-safe. The author, advocating for a tidier code style, recommends using union types as a safer and more efficient alternative.

Tidy TypeScript: Prefer union types over enums

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

No top articles yet