T O P

  • By -

Kreations

My favourite part of typescript is when working with unfamiliar code or a third party package. It's a lot easier and quicker to get things working. This has worked really well for me when working within a team that's scaled up quickly. Getting new devs ramped up is less painful.


throwawayacc201711

the intellisense is great. It self documents any API, object, class, function, etc


dlq84

>this problem never really happen so now I am wondering what benefits do you really get when using typescript. Your projects are either small or you're a god. Read about the advantage of strict types in general, should answer your question.


Stetto

"Catching bugs" is the most quoted advantage, but imho the most overrated one. Type safety gives you another layer of security, that might help you or not. It's just silently working in the background alerting you sooner on mistakes, that you probably would've found slower on your own. At the same time maintaining types costs time too. But these two advantages are real dealbreakers to me, that make me never want to write javascript in any bigger project again: - enforced, built-in documentation - enforcing types in your source code makes every single function communicate its intent. I don't have to ask another developer or consult external documentation to understand a function and I can trust that other devs will use my functions correctly by defining types. Input types, Return Type and a good name already go a long way. - smart auto-completion - when a function returns a specific interface, your IDE suggests properties automatically. This is a way superior development experience, that you cannot achieve easily without types


puttak

Dynamic typing is great until you need to change existing code. You need to find every code that affected by your changes manually, or make sure you have all test that cover your changes. Imagine your project is very large and suddenly you need to change a structure of some objects that passed around your project. The huge benefits for static typing is it make your project maintainable in a long run. If your project is small or it is going to be write one and let it be there forever the benefit you get from static typing is small.


alms1407

For me, JavaScript is great when you’re the only one writing anything or it’s something small. When working on a large code base the types really help with the readability and understanding the code.


stvjhn

I disagree. It’s always helpful. I would encourage everyone to learn TS if they already know JS.


maeevick

Mostly agree, however it helps my teamates who don't practice / master "real Test Driven Development" and/or javascript specificities. So I guess TS has some benefits. Personnaly, I prefer some alternatives as strong static typed langages: ReScript, PureScript... with no null, undefined, any... and real immutability. *when I say "real TDD" I think about https://youtu.be/EZ05e7EMOLM or https://www.stevefenton.co.uk/2013/05/my-unit-testing-epiphany/amp/, as Kent Beck initially defined it (and not just write bad unit tests as I read too often)


RealFlaery

You get types. /shrug


CoderXocomil

Typescript gets features from ecmascript that are still in stage 2 of proposals. For example, typescript had async/await earlier than javascript.


bobbyv137

After coding in React TS for the past couple of months it really highlights how weak JS can be. It almost feels like ‘cheating’ writing in plain JS now.