DEV Community

Discussion on: 7 Tips For Clean Code

Collapse
 
akashshyam profile image
Akash Shyam

Whoa! Controversial statement right there 😂, I agree with the fact that network calls, third party libs cant communicate with TS. Even though we need to write some extra code, it helps a lot in the long run. It just boosts vs code autocomplete so much that it's become difficult coding in vanilla javascript now 😅. People who are new to the codebase can figure out types of arguments/variables/functions etimmediately.

You know what, I'm going to post about this next time and discuss with you guys!

I see TypeScript as a dying tech. It was discussed tones of times so I'll place a little brief: it's a subset of JS (not a superset, it's something that compiles into js, so it cannot be a superset by definition) thus it obscures and limits what you can do with javascript while providing a fake peace of mind. Network calls, third party libs and so on have no way to communicate with TS. This is anyway, another discussion.

Collapse
 
joelbonetr profile image
JoelBonetR 🥇

Hahaha it could be funny or a mess, let's see how this discussion ends :P

For the intellisense (autocompletion) you can use plugins for that as you are probably using for TS, either way the types are most of time not so important and not required on JS as long as you can create your own classes and types as well and you can ensure the data is of the type you want or need on any data flow.
You can of course, simply check types where's implicitly needed with typeof so no breaking benefits of having TS. As i said, you simply cannot do a single thing with TS that Is not available in JS while adding some throwbacks as the mentioned above so... I can see a clear #1 winner here 😂😂😂

Thread Thread
 
akashshyam profile image
Akash Shyam

But typescript offers some extra functionality that javascript does not have like Readonly variables, private/public/protected properties and methods in classes etc etc.

In the end, it all comes down to preference

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇 • Edited

As I said, there's NOTHING that you can do using TS that can't be implemented using JS.
stackoverflow.com/questions/242840...

For instance, there are things that you cannot do with TS that definitely are available on vanilla JS :D

Apart from that using a feature just because it's here is most of time a bad analysis of what do you really need to reach a given software solution, and anything that you feel missing or unexperienced/lazy to develop by your own, there will be a babel plugin or whatever that cover that need hahaha

Thread Thread
 
akashshyam profile image
Akash Shyam

Instead of continuing this discussion, here check out all my points and views here.

Thread Thread
 
joelbonetr profile image
JoelBonetR 🥇

finished my text and commented on the proper discussion :D

Thread Thread
 
akashshyam profile image
Akash Shyam

Lol 😂