Exploring TypeScript and why it’s popular.
As a recent Software Engineering graduate. I see more and more companies are seeking TypeScript experience on their job listing and today I will get into a brief explanation of what TypeScript is and why employees are seeking for TypeScript developers.
What is TypeScript?
Why use TypeScript?
There are many reasons to use TypeScript but here is a list of my Pros and Cons for using TypeScript
- TypeScript Compiler-This is probably my favorite reason to use TS. With TypeScript, you can use the TSC(TypeScript Compiler) to choose a target version of ECMAScript to translate your TS code into. This is super helpful in the case if you know your target customer base won’t have a modern browser, you can simply set your TSC to compile your code into older versions of JS that can be run on older browsers.
- IDE Support-It offers a lot of built-in info related to your code since TypeScript is developed by Microsoft, it is widely supported by Visual Studio & VS code and various IDEs such as Atom and Sublime editor.
- Cross Platform-The TypeScript compiler can be installed on popular operating systems such as Windows, MacOS and Linux.
- Extra code-You will have to spend more time writing code, if you have to specify the Typing of a bunch of variables in a big project. This Con is also kind of a Pro in my opinion, you might have to spending a little extra time writing code today but the value of preventing small future errors is a pretty good trade off.
- Compiling Time-Since TypeScript needs to compile the code into JS, that can take time depending on the size of the project and the strength of your CPU which can cause a bit of lag while live coding.
How to install TypeScript
You can simply install TypeScript with your package manager such as yarn or npm
npm install -g typescript
What this command does is install the TypeScript Compiler to your local environment. After the installation is complete, you can create .ts files and compile them with the tsc command.
Once the compiler is complete, you will see a .js file along with your .ts file that was just compiled.
Resources to learn basic TypeScript
- TypeScript: Documentation — TypeScript for the New Programmer Learn
- TypeScript | Codecademy
- Learn TypeScript in 5 minutes — A tutorial for beginners
I am currently working on a personal big scale project with TypeScript and I will be providing future blogs on how to use TypeScript, so stay tuned!
Thank you for reading and please leave a comment if you‘ve enjoyed and follow for more coding content.