Hello there, I believe you landed on this article because you are probably a javascript fan and looking forward to upskilling yourself by learning the popular programming language called Typescript. Whatever your reason is, I promise to deliver an interesting and informative explanation of typescript and how you can adopt it in your next or existing project.
What Is Typescript
Typescript is a programming language that builds on the javaScript programming language. But what makes typescript a language to be trusted for use in project(s). Typescript is a strongly typed superset of javaScript which compiles to plain javaScript. Typescript can be used with any browser or operating system since at the end of the day, the code that gets generated and sent to the browser is javaScript. It contains all the elements of the javaScript programming language and additional features. It is a language designed for large-scale javascript applications developement.
TypeScript cannot run directly on the browser like javaScript. Many latest browsers do not have typescript support. It needs a compiler to compile the file and generate it in JavaScript file, which can run directly on the browser. The TypeScript source file is in ".ts" extension. We can use any valid ".js" file by renaming it to ".ts" file. TypeScript uses TSC (TypeScript Compiler) compiler, which convert Typescript code (.ts file) to JavaScript (.js file).
As I mentioned earlier, typescript is a stongly typed langauage. Whcih means it approves the high usage of types in it. Now lets get to learn the tradeoff between Static and Dynamic typing.
Static vs. Dynamic Typing
The difference between static and dynamic typing has to do with when the types of the written program are checked. In statically-typed languages (TypeScript), types are checked at compile-time. In dynamically-typed languages (JavaScript), types are checked at run-time. Now lets get to the point you have been waiting for.
How to get started.
The first step needed in order to use Typescript is to install it globally on your computer by using NPM (Node Package Manager). In case you are new to NPM, to use it you need to have Node.js installed on your computer (for help with Node.js installation click here). To check what version of Node.js and NPM you have just enter the following commands on your terminal:
After ensuring that you Node.js installed in your computer, enter the below command on your terminal:
The above comman executed will install TypeScript globally in your computer allowing you to use it within any project that you have on your computer.
Congratulations to you for getting this far in this article.
One of the ways I have found that has helped me learn stuffs easier and faster in the software developement space is, knowing the reason why I should learn a particular programming langauage, framework or library. After i am satisfied with that, it boost my morale to learn it.
Why use TypeScript?
Typescript is mostly used because of the following reasons:
TypeScript supports Static typing, Strongly type, Modules, Optional Parameters, etc.
TypeScript supports object-oriented programming features such as classes, interfaces, inheritance, generics, etc.
TypeScript is fast, simple, and most importantly, easy to learn.
TypeScript provides the error-checking feature at compilation time. It will compile the code, and if any error found, then it highlighted the mistakes before the script is run.
TypeScript supports all JavaScript libraries because it is the superset of JavaScript.
TypeScript make app development quick and easy as possible, and the tooling support of TypeScript gives us autocompletion, type checking, and source documentation.
Developers can save a lot of time with TypeScript.
TypeScript make app development quick and easy as possible, and the tooling support of TypeScript gives us autocompletion, type checking, and source documentation.
Now I hope the above points have given you the reason why Typescript is one of the best programming languages out there to learn.
I shall release part two of this article whcih will feature the technical aspects of typescript. Basically, we will learn how to write codes using the typescript programming language.
Top comments (0)