DEV Community

Slick3gz
Slick3gz

Posted on

What about TypeScript?

πŸ‘‹

Just picked up a course about Angular from Udemy. Noticed that it uses TypeScript instead of JavaScript. Would love to hear people’s thoughts about TypeScript in general?

Useful?

Gonna be around a while?

Tried TypeScript but went back to Javascript?

Drop your comments below.

Top comments (4)

Collapse
 
deciduously profile image
Ben Lovy • Edited

Useful? In my opinion, yes in a general sense. More objectively, probably most useful in large codebases.

Gonna be around a while? Likely. It's got the full force of Microsoft behind it, and is already a standard in the industry - Angular, VS Code, etc.

Tried and went back to JS? Nope, quite the opposite for me - tried and now hate having to go without it. It's addictive, but I'm a static types kinda guy, YMMV.

What's great is that it's a superset, everything you learned about JavaScript (especially ES6) still applies to TS, and a lot of what you learn moving forward with TS will still apply back to JS, except for the fancy type stuff. It may even push you towards different (hopefully better) vanilla JS patterns as you get used to typing your code. You're a C++ guy, though, so you'll feel familiar quickly.

It's also gradual - you don't need to type your whole code base at once. You can cheat with any. To me, TS over JS pretty much just a pro, the only con is that it is a new set of tools and config settings to learn but it's really not that bad.

Collapse
 
kylefilegriffin profile image
Kyle Griffin

In my experience, I have been preached Typescript by those who depend on it. For some, it is the perfect answer to a lot of inherent modern JS issues that they cannot go back. And that's a problem because it's the same thing as jQuery developers who defend it to their last dying breath. We would end up with more divide in the webdev community, with everyone thinking their way is the only way to code JS.
I've been handed .ts files and I can't read it. I was faulted for not being able to, when I just don't have enough time and motive to learn TypeScript until I need to. So it brought the project to a crawl and the TypeScript devs were so adamant about using it that they would rather potentially screw up a 6-figure project just out of principle. And that's a big problem.

Collapse
 
slick3gz_ profile image
Slick3gz

Good points. Something I hadn’t even considered. Thank you for your insight.

Collapse
 
alistaiiiir profile image
alistair smith

Amazing, especially in a team, as it forcibly makes sure everybody is using the same parameters for functions, passing the right types and enforcing good practices + clean code all at the same time. When paired with Webpack and react, typescript is amazing.

BUT, regarding going back to JS; initially, I wanted to. A lot of the syntax was a little overwhelming. I had never really worked with strict typing, and so TS was a little learning curve. I persisted, I learnt how to use TS better, and it's now my programming language. IMO, keep at it, it will be worth it! Good Luck OP!