The Main Reason I Love TypeScript
As a young (*not necessarily in age, just in general experience) developer, I have recently fallen in love with TypeScript… sure, it’s a bit more complex to understand and to set up a project with, but I’ve found several main advantages leading me to prefer TypeScript over JavaScript.
While TypeScript is a superset of JavaScript, and the two are quite similar at heart, I have learned to love TypeScript for its built in and well documented error handling and intellisense.
Almost every time I work in JavaScript I find myself continually testing weird things as a user to verify whether or not I am seeing the right results. In TypeScript, almost any time I do something that isn’t as it should be, TypeScript tells me the issue right in my code editor, and points me in the right direction to fix it.
Differences
- TypeScript is known as Object Oriented Programming, while JavaScript is known as a scripting language.
- TypeScript is statically typed, while JavaScript is not.
- TypeScript supports modules, while JavaScript does not.
- TypeScript has Interface, while JavaScript does not.
Advantages of TypeScript
- TypeScript points out compilation errors in development, while JavaScript interprets errors as they happen in run-time.
- TypeScript checks for type errors while JavaScript does not; no more finding out that your returned data is NaN.. You’ll know that in your code editor!
- Supports JavaScript libraries and API documentation.
- More maintainable and scalable.
- Higher average developer salary!
Advantages of JavaScript
- Usually faster to write, less code, and lower learning curve.
- Doesn’t require a timely compilation process.
- Much larger community of Developers.
- Flexible and easier to learn scripting language.
- Most common language for web development = well documented, lots of libraries and API’s, and no build step required.
Wrap Up
In general you can’t go wrong with either option, they are both amazing languages for web app development, and they both have some key advantages. I have really enjoyed learning TypeScript, and plan on continuing down that path, with my eyes on that higher average developer salary!
Cheers — I’ll see you again soon!