January 26, 2023
Before you continue this is the best Tip I've for you:
Do not "LEARN" TypeScript, build your projects with it.
If you go down the TS rabbit-hole while trying to figure out what's good about it, You will ran into these tweet/videos/etc showing up some reeeally advanced code, making heavily use of the advanced features TS provides... they call them TS-wizards. So. maybe a dev who mainly during his career used plain JS this advanced TS may look way too intimidating.
You may start looking at that type of code if maybe you want to build or work on something like a lower level library that needs to abstract a lot of code, provide many interfaces, etc.
Here is an actual fact:
You don't need to be a Wizard or have a CS degree to start building and taking advantages of this amazing technology. If you are familiar with JS/Node or any other framework like React your are set!
It is a dynamic language, where we can do all kind of crazy things, like:
It means when you open a TS file you can write plain JS, with all TS extra features being optional; but out IDE / analyzers provide feedback right when something is wrong as you type it: Example: using a variable that's out of scope.
Behaves something like a compiled language, and we can say javascript is the compilation "target"
This is the primary goal of TS: provide type safety, which is a huge benefit over JavaScript, this way you can catch errors at compile-time, rather than runtime. This means you can avoid many of the errors that commonly occur in JavaScript, such as typos, undefined variables, and incorrect function arguments. In the long run, this can save you a lot of time and effort in debugging your code.
For example, let's say you have a function that takes two arguments, a string and a number. In JavaScript, if you accidentally pass in the wrong type of argument, you won't know until runtime. But in TypeScript, you'll get a compile-time error that tells you exactly what went wrong. This can help you catch errors early and prevent them from causing bigger problems later on.
TypeScript offers much better tooling than JavaScript. Because TypeScript provides type information, your IDE or text editor can offer intelligent auto-completion and error checking.
So, next time you start a new project; (whether inside React prison or not); add that --typescript flag to your init commands, you wont regret it :)
I'm a 32-years old programmer and web developer currently living in Montevideo, Uruguay. I been programming since I was about 15 y.o, and for the past 12 actively working in the area.