Is TypeScript Really Necessary?

preview_player
Показать описание
📣 Other Social:
Рекомендации по теме
Комментарии
Автор

I work on big projects, maybe not that complicated, but they bring hundreds of millions of dollars in sales every month.
How often do I run into type safety problems? Very rarely. We have maybe one serious bug a year related to type safety? So for type safety reasons I don't think adding TS is necessary. It's just how you write your code and if you can trust the data you receive from various APIs. We write our own API services to integrate with 3rd party tools, so I know 100% what will I get from our API. It's gonna be either object or null, string or empty string, array of items or an empty array. What else is there? Anywhere in code review if we see weak types or type pollution it gets corrected right away. If something slips past reviewer and gets into the code base, it's like 99% probability it's gonna get caught by static code scanner in build pipeline and the merge will be rejected.
Hence like one type bug a year. Usually very minor one, because all critical systems are constantly monitored, tested with automated tests, integration tests and manual tests.

TS's type safety features are only type safety features like any other. Safety features won't work unless developers are aware what they should and shouldn't do. Even the state of the art alarm system in your house won't work if just keep leaving the back door open and ignore all the alerts.

wheresmyskin
Автор

TypeScript prevents so many bugs, it has nice IDE integration and many other things.

nivo
Автор

I use TypeScript with extremely strict eslint rules enabled, and it's still not enough. Dumb bugs still make it into prod that would have been caught at compile time had I used Rust (which I now exclusively use for my backend). Yes TypeScript is necessary. Reading an untyped legacy codebase for the first time made that painfully clear to me.

FinaISpartan
Автор

TypeScript is like driving with a seatbelt. When it was first introduced, people used to the old way of things thought it was uncomfortable, but it's still extremely useful and most people can't imagine doing something as dangerous as not using it

samuelgunter
Автор

IMO, not worth it. Modern JS, testing, and a library like superstruct used correctly is far superior. Typescript adds a ton of boilerplate that is not necessary to make a good app. It basically removes all the flexibility JS has and in return you get something like Java or C#. The one thing that is nice is being able to specify types online instead of using jsdoc (but I hardly think this justifies all the rest of TS) Disclaimer: I've been programming JS for over 15 years, so might be a little biased - I've done a decent bit of debugging and only maybe 10 bugs I've dealt with in that time were type related.

etherweb
Автор

As a beginner, I like Typescript since it makes me think more about the architecture and function of the code. A big mistake as a learner is to jump to quickly into coding without enough planning and design. And too often, I would not think enough about my functions, and I would code myself into a corner. So, it’s to not to bad for me to have to slow down and lay the types before actually coding my functionality.

whiterockjoe
Автор

Personally I really just like the self documenting aspect of it and knowing what my subscribers and consumers use and produce

hamm
Автор

Typescript makes it easier to mirror c#, like you said. It makes more sense to me as a mid level developer to compliment JavaScript and angular makes it more seamless to work with.

shirleycrew
Автор

I'm a junior and always preferred strongly typed languages, most of my peers who do front-end don't like typescript but I would always prefer compile time to runtime errors, maybe they don't like angular and link ts to it since most non angular teams in my country don't use ts

alexbecar
Автор

I really cant understand how anyone is able to work with dynamic languages. I need my type system 😅

ingmarfalk
Автор

completly necessary, I'm working in a complex app as a newcomer and it is a pain to work on without typing.

darkfoxwillie
Автор

Strict null checks are awesome. Yes they are more work. Yes they prevent a lot of bugs.

devincheca
Автор

It would be nice if you could go over how modern web development is less web development, and more application development for the web. We all start learning how to build websites and then somewhere along the line we’re expected to turn into software engineers instead of website developers. I truly believe that there should be a delineating line between web development and web application development. Otherwise, it becomes too complex and confusing for beginners, or for people who just want to build websites.

codybishop
Автор

I struggled a lot with JavaScript in the past just because I didn’t understand what function or property I was calling or needed to call in order to achieve the functionality I needed. With typescript this all changed, it basically filters and tells you exactly what you need to call in order to get that functionality working, so besides the type safety, my main reason for using typescript is to have a more cohesive experience when it comes to programming

andreachello
Автор

I was very sceptical at first. But I don't think I can go back to regular js for anything other than really simple stuff. Purely from the DX it is so nice to have first class IDE support for interfaces rather than having to dig into the implementations to figure out what something should be doing. Inference is pretty powerful too. Strict null checks are pretty nice too.

penry
Автор

If I'm starting a backend project that needs to be statically typed, I would rather use C# or Java instead of Typescript. But converting a nodejs existing project to Typescript is definitely an improvement but it will bring a lot of headaches with it. The beauty of Javascript is that it is dynamically typed and very flexible to code with.

viniciusalvess
Автор

The thing I love about typescript is having to click through a variable 7 levels deep to figure out what it references. That's efficiency.

purpinkn
Автор

Wow, the perfect video at the perfect time. I just started learning Typscript today. My first thoughts were, "Really? I'm going to forget that 'Frank' is a string?" I've been using JS for React for a while now and friends have said, "Oh man, you have to learn TS. You have to!" Perhaps on huge projects with a lot of devs working in the code I can see its value, but for smaller projects that I work on I just don't see any value in the added code. I've just not ran into the kinds of problems people are having using JS in which TS catches.

kamaboko
Автор

For frontend apps, typescript inarguably brings some advantages :
- better integration between the different components and layers of the app
- code misconception prevention
- self documentation,
- autocompletion etc...

It is a very powerful tool, that you should consider using, for frontend apps instead of pure js.

On the other hand, for backend projets, with node js, and any other type of project where security issues matter, it is almost necessary to use a somehow strictly typed language such as typescript... Because, Without strict typing, you may inadvertantly write insecure code... Especially code that allows malicious data injection... Typescript becomes then almost a necessity.

mostafaelbarrak
Автор

Sometimes JS Docs is all you need! Even when you are doing just vanilla JS JS Docs can be helpful.

dovh