Skip to content

Comment on Ask HN: Is it worth it to invest in learning TypeScript?

Comments

If you use JS to sprinkle in some jQuery style interactivity on an otherwise static website, then TypeScript is not worth it because of the additional overhead. For anything more complex and most single page applications, yes do use TS.

TS offers a better developer experience (better code completion in your IDE), types help document your code and refactoring will be less painful. Also you gain some level of type safety (though less than languages with a sound type system).

Drawbacks are slow compile times and cryptic error messages and general having a additional tool that adds complexity. Also the level of type safety is dependent on how disciplined you are (though some linting rules might help).

There are languages with much better type systems and faster compile times that transpile to JS that might also be worth noting like Elm, ReScript, Purescript and so on but TS has of course the best migration story with the "just JS but with types" promise.

So generally, yes learn it, use it.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.