TypeScript Enums are TERRIBLE. Here's Why.
TypeScript enums have worn their welcome. In the early days before string unions became so powerful, there was no other option. Today, though, they are more trouble than they're worth. This talk explores some of the problems with enums as well as some solutions to those problems. No solution is perfect, but perhaps no perfect solution uses TypeScript's enums, either. :P 00:00 how enums work in general 00:45 the value of enums by default 01:00 the first failure of enums 01:30 attempting to fix this problem with required indices 02:00 what do enums look like at runtime? 02:50 another downside: function arguments 03:43 working around the problem with function arguments 04:31 there are footguns (even with workarounds) 04:47 a better approach than enums: POJOs 06:14 audience question: why not just create a string union? 06:59 audience question: runtime values for a bad function argument? 07:56 audience comment: it's still just JavaScript 08:26 audience question: are there any keys on the enum? 09:22 audience comment: TypeScript runtime artifacts === bad 10:06 audience question: how do you deal with variations? 11:25 the satisfies operator could help 12:29 how to solve a new problem introduced by using objects Aaron Harper (https://github.com/goodoldneon) is a software engineer who enjoys gardening, biking, and spending too much time and money on an overkill homelab. Recorded on November 1st 2022 at Cahoots (https://cahoots.com) in Ann Arbor, Michigan.| Discord: / discord Twitter: / mitypescript Mastodon: https://fosstodon.org/@MichiganTypeSc... Instagram: / michigantypescript TikTok: / michigantypescript

Enums are MISUNDERSTOOD (not terrible): Josh Goldberg, typescript-eslint maintainer

Strict TypeScript Isn't Enough Anymore

The TRUTH About TypeScript Enums

TypeScript is being ported to Go | interview with Anders Hejlsberg

Enums considered harmful

TypeScript Enums are Bad // Alternatives to use

The worst programming language of all time

Stop Writing TypeScript Code Like This

TypeSlayer - a TypeScript types performance tool

Typescript Objects, Arrays, Tuples & Enums | Basics Tutorial

TypeScript - The Basics

Generics: The most intimidating TypeScript feature

Turing Award Winner: Disagreeing with Google, Postgres, Future Problems | Mike Stonebraker

NASAs Coding Requirements Are Insane

"We Ran Out Of Columns" - The Worst Codebase Ever

Typescript Generics Tutorial

How to use TypeScript Enums and why not to, maybe

RUST Enums ARE Better

One Formula That Demystifies 3D Graphics

