Syntax - Tasty Web Development Treats

Hasty Treat - Enums in JS (GraphQL and Typescript)

6 snips
Oct 5, 2020
Discover the fascinating world of enums in JavaScript, along with their utility in GraphQL and TypeScript. The discussion reveals how enums aid in managing predefined values, enhancing code reliability and clarity. Learn about the current limitations of enums in JavaScript and the proposals on the horizon. The hosts share their personal shifts in perspectives towards TypeScript, highlighting its benefits amidst community debates. Tune in for insights that could elevate your programming skills!
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

Enums Explained

  • Enums are a type with predefined options, simplifying documentation and preventing edge cases.
  • This aids in error handling and ensures valid values.
ANECDOTE

Product Code Issue

  • Wes Bos encountered an issue in his course platform due to an incorrect product code.
  • Using an enum would've prevented this by restricting options and catching the error early.
INSIGHT

Enums as Select Lists

  • Scott Talinsky visualizes enums as select lists on the front end.
  • This representation helps understand their practical application.
Get the Snipd Podcast app to discover more snips from this episode
Get the app