So you’re wondering, should I learn TypeScript or JavaScript? Well, that answer depends on a few key factors and where you are in your coding journey. Generally speaking, I would recommend that you learn JavaScript before learning TypeScript. In this article, I am going to explain why that is the case and why sometimes it makes more sense to learn TypeScript first.
So without wasting too much time, let’s jump straight into what you should learn, JavaScript or TypeScript.
Why You Should Learn JavaScript Before TypeScript
1. This Is Your First Programming Language
First things first, if you have not learned a programming language yet, I highly recommend you start by learning JavaScript. The primary reason I recommend this is because there is a lot more learning material out there to teach you JavaScript than there is to teach you TypeScript. Most TypeScript tutorials will also assume you already have a decent understanding of JavaScript. If you already know a programming language, it isn’t too difficult to jump straight to TypeScript. However, you will likely find it much more challenging, and much less rewarding, to skip JavaScript without much programming knowledge.
2. You Want A Deep Knowledge of JavaScript and TypeScript
The second most important reason to start by learning JavaScript before TypeScript is if you want a deep knowledge of both JavaScript and TypeScript.
This is because TypeScript is simply a superset of JavaScript. It is essentially JavaScript with a built-in type system that is geared towards object-oriented programming.
JavaScript has a lot of quirks and it is a bit of a strange language to wrap your head around. The language has many caveats that are not in any other modern programming language. It takes a bit to really understand the advanced concepts that make JavaScript the language it is. Such as the prototype chain and its use of functional programming concepts. If you skip over these and learn TypeScript, it may be hard to understand what makes JavaScript so unique. By studying the OOP way of thinking about JavaScript, these concepts aren’t quite as clear.
In addition to this, you will also fail to see why TypeScript is such a great enhancement to JavaScript and the problems it solves. By skipping JavaScript, you won’t understand how you can build better, more scalable applications with TypeScript, you just will.
Remember kids, knowledge is power!
Why You Should Learn TypeScript Before JavaScript
While, in general, I believe you should learn JavaScript before you learn TypeScript, there are a few instances to learn TypeScript first.
1. You Know An Object-Oriented Programming Language
If you already know an OOP language like Java, C#, or Python, it might make sense to learn TypeScript first. It will allow you to get used to the JavaScript-like syntax while coding in a style that you are already accustomed to.
Since TypeScript follows an OOP paradigm, the jump from an OOP language you already know to TypeScript could allow you to pick up the language faster. This is especially useful if you are learning TypeScript simply because your company is using it at the time and you need to understand how to code with it.
2. You Need To Learn TypeScript Quickly / Don’t Need To Understand JavaScript
In 2022, JavaScript is still the king of web development and isn’t going anywhere anytime soon. There are a ton of software out there not utilizing TypeScript and you will be cutting yourself off from those jobs if you decide you are not going to learn it.
In addition to that, even if you want to become a TypeScript developer, it might be difficult to find a job without proof of your JavaScript knowledge. Employers are going to want to see that you know both, not just TypeScript.
Of course, this is much less important if you just want to see what all the hype is about with TypeScript or you already work at a company that is utilizing TypeScript. For that reason, you can probably skip past learning JavaScript in favor of TypeScript.
Summary: Should You Learn JavaScript or TypeScript
Overall, if you are deciding to learn TypeScript or JavaScript, I personally recommend learning both. JavaScript is still a powerful language and you are not always going to have the ability to work with TypeScript in the real world. However, I highly recommend you learn JavaScript first in order to gain a strong understanding of both TypeScript and JavaScript. This is especially true if you have not learned a programming language yet. I definitely don’t recommend you learn both of them at the same time.
However, if you come from an object-oriented programming background, it might make sense to learn TypeScript first. It is also justifiable to just learn TypeScript if you are just learning for fun or to have a basic understanding of your company codebase and not someone looking to start a professional career with TypeScript.
That’s pretty much it! If you’re a new developer just getting started out with web development, check out my free resources. If you want some other great courses to help you learn, check these out.
Happy coding!