Live data from Hacker News

TypeScript Features to Avoid

executeprogram.com

211–212 of 212 posts

Re: TypeScript Features to Avoid

#211

> 1. Avoid Enums What? This is IMO bad advice. Having a sum type is quite handy for general type-checking, at least insofar as the type truly is an enumerated type (i.e. all possible values are known at design-time). There have been times when TypeScript enums have been indispensable to me when declaring the external interface to some client-facing API. Whatever the API boundary is, a sum type is useful. Also, TypeSc…

What are the advantages of enums over a string literal union? I can only see disadvantages.

[deleted]

Re: TypeScript Features to Avoid

#212
TypeScript has a lot of features that just generate cognitive overhead that could have been better spent just learning a different language.

I like TypeScript a LOT, but to be honest I only use about 10% of it. Anything more than that and it gets too confusing for the next developer in line to work on the code in my experience.

Post reply on HN