Why am I NOT a fan of TypeScript

TypeScript is slower than JS, in simple iteration, the difference is only a few percent but when it comes to more complex ones, it is quite enormous. The reason comes from TS’s structure, which is transpired to JS (plus additional coating). Check efficiency here!

Personally, I think most important is the efficiency of the code and how to optimize it, comfort and speed of writing code come second. Especially in long-term projects that are supposed to work for a few years. Why is it so important? Because if we will not have enough computing power in vertical scaling (more and more powerful machine), we have to transfer to horizontal scaling (cloud hosting, clustering, etc.). The price of rewriting the 1-instance application to a cluster one may exceed 100% of the project’s cost. Additionally, the price of adding a new machine is not proportional to the growth of profits and a firm has to decide on losses associated with scaling or has to limit access to the service and stop the progress. Progress is a basic rule of every firm (without it the firm will die in the span of 5 years). Hence it is better to choose a quick language and write a code 2 times longer (one-time cost) than paying triple for hosting every month.

There is another issue

The security of typing. I mentioned this, a few times already, typing works only within our code. The problem is data coming to our app from the outside – either 3rd party API or from a user. Us typing some kind of variable to string does not mean the app will check by itself the type of a variable after transpiring. If we will not write code that will check variable type the app will show errors, the same goes for JS. Two real-life examples – outside API changes its structure daily, without updating to a newer version (existing endpoints change, unfortunately, it happens sometimes). If we will not write in a TS/JS code to check what kind we get will not get the app to work. The second one, the communication between Frontend and Backend. We made a joint interface for data exchange (ex. Email/password - 2 strings), In TS everything compiles in frontend and backend, but we did not type in a line to check the type and instead of strings we send objects. Bam backend error.

Retranspiling the code

Every change in the code means compiling the whole application, it takes only a few seconds, but during 8 hours of work we have to compile code about 300 times, we lose 15 to 30 minutes of waiting. And what if we have a serious error in code and we have to quickly fix production? When it comes to JS you can fix it in Git, throw it to the server, restart only one service, and if something is very urgent, we can change it directly on the server and do a quick restart - in an ideal world, this should not be done, but practice looks bit different. I personally fixed bugs in production versions this way many times. In TS we cannot directly edit code, we have to edit the source and compile it, which takes a lot of time. If we do not know if the change will help, we lose once again, a lot of time, and production is halted.

Typing is just great

But only if it is natively built-in into the language (Java, Rust). When it comes to transpiling code we are in deep shit. Additionally, I think best is the flexible languages, you type if you want, not because you have to. Deno is a promising option, a new baby from the creators of Node. In Deno, we have a natively built-in compiler TypeScript. We code in TS and the virtual machine transpile the code to Rust. No problems with efficiency unlike TS to JS to V8. Unfortunately, Deno is a starting project and we cannot be sure If we will one day see a stable version.

Afterthought, half in jest half-seriously, if you need typing because you are getting lost in code, you are not a programmer you are a dumb-dumb 😛

Content

Got a project?

Let's talk!

__wf_zastrzeżone_dziedziczyć
Technologies
What is AWS?
arrow icon
4.1.2024
2 min read
Technologies
Technologies
HTML - co to?
arrow icon
3.20.2024
2 min czytania
Technologies
What is HTML?
arrow icon
3.21.2024
2 min read
Technologies
Technologies
TypeScript? - co to?
arrow icon
3.20.2024
3 min czytania
Technologies
What is TypeScript?
arrow icon
3.20.2024
3 min read
Technologies
Technologies
PHP - co to?
arrow icon
3.19.2024
1 min czytania
Technologies
What is PHP?
arrow icon
3.19.2024
1 min read
Technologies
Technologies
Swift - co to?
arrow icon
3.18.2024
5 min czytania
Technologies
What is Swift?
arrow icon
3.18.2024
5 min read
Technologies
Technologies
Kotlin - co to?
arrow icon
3.16.2024
4 min czytania
Technologies
What is Kotlin?
arrow icon
3.16.2024
4 min read
Technologies
Technologies
Vue.js - co to?
arrow icon
3.15.2024
3 min czytania
Technologies
Technologies
What is Vue.js?
arrow icon
3.15.2024
3 min read
Technologies
Technologies
JAVA - Co to?
arrow icon
3.14.2024
4 min czytania
Technologies
What is JAVA?
arrow icon
3.13.2024
2 min read
Technologies
Technologies
React Native - co to?
arrow icon
3.13.2024
3 min czytania
Technologies
What is React Native?
arrow icon
3.13.2024
3 min read
Technologies
Technologies
React.js - co to?
arrow icon
3.13.2024
2 min czytania
Technologies
What is React.js?
arrow icon
3.13.2024
2 min read
Technologies
Node.js - co to?
arrow icon
3.13.2024
1 min czytania
Technologies
What is Node.js?
arrow icon
3.13.2024
1 min read
Technologies
Technologies
JavaScript - co to?
arrow icon
3.13.2024
1 min czytania
Technologies
What is JavaScript?
arrow icon
3.13.2024
1 min read
Knowledge hub
Knowledge hub
Kim jest fullstack developer?
arrow icon
3.13.2024
1 min czytania
Knowledge hub
What is a fullstack developer?
arrow icon
3.13.2024
1 min read
Knowledge hub
Knowledge hub
Co to jest frontend?
arrow icon
3.13.2024
2 min czytania
Knowledge hub
What is frontend?
arrow icon
3.13.2024
2 min read
Knowledge hub
Knowledge hub
Co to jest backend?
arrow icon
3.13.2024
2 min czytania
Knowledge hub
What is backend?
arrow icon
3.13.2024
2 min read
Business
Business
Profesjonalna aplikacja dla firmy - 10 wskazówek
arrow icon
5.12.2023
7 min czytania
Business
Business
Doradztwo IT - korzyści dla Twojej firmy
arrow icon
3.21.2023
6 mi czytania
IT
How to get started in IT?
arrow icon
3.6.2023
7 min read
IT
WEB3 - What is it? Introduction
arrow icon
2.21.2023
4 min read
Code
Code
Czy MobX to dobra alternatywa dla Redux?
arrow icon
2.1.2023
3 min czytania
UX/UI
UX/UI
UX Design - przewodnik dla programistów
arrow icon
1.30.2023
4 min czytania
Code
Code
Podstawy React’a - stan i hook useState
arrow icon
1.26.2023
5 min czytania
Startup
Startup
Startup - z jaką firmą IT współpracować?
arrow icon
12.20.2022
11 min czytania
Business
Business
Najlepszy kraj do outsourcingu IT
arrow icon
12.12.2022
4 min czytania
Business
Business
Jak zmienić firmę programistyczną?
arrow icon
12.2.2022
4 min czytania
Business
Business
Outsourcing IT- kompletny PRZEWODNIK!
arrow icon
11.28.2022
3 min czytania
Business
Business
Team Augmentation - Korzyści!
arrow icon
11.23.2022
9 min czytania
Business
Business
W co inwestować pieniądze w 2021 roku?
arrow icon
11.21.2022
3 min czytania
Business
Business
Praca w różnych strefach czasowych. Jak to działa?
arrow icon
11.18.2022
7 min czytania
Startup
Startup
Co to jest startup? (Nowoczesne Przedsiębiorstwo)
arrow icon
11.17.2022
6 min czytania
Business
Business
Co to jest outsourcing pracowników IT i ILE kosztuje
arrow icon
11.14.2022
5 min czytania