
Typescript is a must-know tool if you plan to master web development in 2025, regardless of whether it's for Frontend or Backend (or Fullstack). It...
For further actions, you may consider blocking this person and/or reporting abuse
I've read from other articles that enums are to be avoided when it comes to data structuring in TypeScript. Lemme know if you have a different opinion. Overall, this is a well summarized reference and thanks for sharing.
Yeah as mentioned in the article,
enums
may break pre-existing data in the DB if new values are introduced (if you don't explicitly mention the mapped values). If you plan to useenums
, mapping them to a specific value is a non-negotiable, but you can always use constant objects, mapping the same values.I personally prefer using
enums
& haven't run into any issues over the past 4 years apart from the unmapped enums being overwrittenGreat post! Clear and concise!
However I wouldn’t recommend enums since they have many issues. Best to combine an map with as const and create a type from it 🙏
Check out the response to the other comment
So that is not the only issue with enums. The other thing with enums is that you cannot pass a string (which is the same value as the enum): which is super annoying.
You can write your own helper to convert the string to enum:
Personally use zod to tackle the transformations & handle all Document/DTO schemas
Fantastic article! It really highlights how powerful TypeScript is for catching errors early, improving code readability, and making large-scale projects easier to manage. Once you get used to it, it's hard to go back to plain JavaScript.
Nice! The tips on type inference and literal types are particularly handy, and I appreciate how you've broken things down into easily digestible bits that both newcomers and seasoned devs can benefit from. Shows just how much you can optimize your code with just a few key tricks. One suggestion I’d throw out there is a quick mention of using TypeScript with async/await patterns and sometimes the type inference can be a bit tricky there, so a little guidance would be useful.
The only difference is when using
async
, the return type gets wrapped by aPromise
When you
await
, thePromise
gets unwrapped & you can use it as a regular valueEverything else mentioned in the article still holds true regardless whether you are using
Promises
or notThis was such a fun and insightful read! I love how the tips cut through the fluff and really emphasize habits that elevate code quality—like mastering utility types, using discriminated unions, and embracing type inference wisely. It's kind of like when you switch from watching random content to curated lists on PlayPelis APK—suddenly, the experience feels smarter and more intentional. Have you found one of these TypeScript tricks that gave you that big "aha!" moment in your own projects?
Definitely literal types & using type guards - it insanely simplified handling types
Insane, this makes TypeScript feel way less scary tbh. The index signature vs Record part always trips me up lol.
Are you even sleeping lol? I see you in almost every post. or you're bot haha?
Nice article ! When I was learning Typescript, these Cheat Sheets on their website really helped me.
Good list, although I do not use the TS-enum but other alternate structures for it.
This awesome. I use some of these but not all. Thank you!
I like it
no joke, posts like this are what got me through my first typescript repo
You missed generics and discriminative types
Re-read the article - generic are there & even though I don't explicitly mention the term
discriminative types
, it's touched upon in the Type guard section