TypeScript isn’t helping anyone
Helping out those with inexperience? Don’t waste my time.
--
This is a typical tale of 10 or so reasons why you shouldn’t use TypeScript (TS) and stick with JavaScript(JS) instead.
Except in this article there is a sting in the tail (or you can skip to the end, the fact is TypeScript is not the answer to every problem and the real issue is software developers do not seem to grasp the problem they are solving before reaching for the solution).
The assumption
The existence of TypeScript indicates that there is something wrong with JavaScript. In my years of developing I actually agree that there is something wrong, many things to be precise.
However, who said that the main problem is typing? Why is this a problem, and what trade-offs are there which are needed to solve this problem?
When a manager chooses to, say, implement TypeScript into a project have they looked at the issue and the solution and weighed up which solution is approprate?
Unfortunately, not in my experience. They’re more likely to have used it in their last project which “worked just fine” and make that happen in your project. Analyze the data, anyone?
Finding the problem
Yes, we can all have fun poking holes in JavaScript.
NaN === NaN
is, of course false.
Semicolons? Yeah, or not. Whatever you want. In college we thought that was a cool feature. Right now with our junior developer? Not so much.
Yet that same junior developer finds online resources split between JS and TS and (seemingly) can’t differentiate, causing problems. Our CR call with that developer wasn’t good, unless you count exasperation all round being the defining reason for the meeting. The cause? Communication and problem solving on the side of the junior developer’s colleagues.
The limitations
TS limits what can be done with JS. Period. Something coming into the code base limiting us? That might make sense for your project, or it might not. It’s a choice, and and a consideration rather than an automatic one size fits all situation.
Arguments about the details of the difference between JavaScript and TypeScript miss the point. I should repeat the idea. The idea that this article is based on: “That might make sense for your project, or it might not.”
Most of the developers I’ve spoken too haven’t even asked themselves that question, let alone others in their teams. A bit of consideration should go into the problem that you’re trying to solve, rather than a technical argument?
The real decision making process
Everyone else is doing it. We need something to catch our buggy code (protip: think about tests?). Company X is using it (are you kidding me? This is an argument?). Your solution to a disparate set of problems is to convert a weakly typed language into a strongly typed variant? If you think this without looking at other options can I have a bit of what you’re drinking?
Let me put this out there. Humans are the ones that write computer code. They are the ones that make mistakes. You’ll need to know your team, of course as well as the project. Yet few put in the work to create the environment for their teams to work in before jumping in with a technical solution.
If you haven’t even bothered implementing a style guide but want to go with TS? I mean, it can work fine. I’m not working with you and if I am, this won’t go on for too long.
Conclusion
The issue is that many developers are working on problems, yet either haven’t defined the problem or don’t know what the problem is that they are solving.
It’s death for professional software developers, and the time spent working on the wrong thing or in the wrong way is just one manifestation of this problem. Is a TypeScript implementation symbolic of this failure to understand the underlying problem? It depends on the case, but misunderstanding or failure to try to understand a problem is endemic in software development.
Since I’m seeing this behavior pattern repeated over time with several developers (I’m not convinced if the most junior are the worst, or the most senior) I’m starting to think that the most important part of an interview is the cultural fit.
I guess for a technical person this is weird or whatever. I’d still say technical skills aren’t the only quality required in a developer and this hasn’t changed over time. People keep disagreeing (without being able to express a reason), probably since the point of the article is that we should be choosing solutions that fit the problem, not making a solution of TypeScript fit the problem. I hope those that needed to, read this far.
Sigh….
About The Author
Professional Software Developer “The Secret Developer” can be found on Twitter @TheSDeveloper and regularly publishes articles through Medium.com