cover-img

Introduction of TypeScript

What is TypeScript, Why should you use it and how does it work?

24 November, 2021

5

5

1

TypeScript is an open-source programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds some features to the language.

How To Install

You can install TypeScript via npm "npm install -g typescript" Then run the compiler via tsc: npx tsc

Why TypeScript

It is nothing but JavaScript with some additional features.

It provides productive development tools.

It makes code easier to read and understand.

It can help us to avoid painful bugs by type checking the code.

How It Works

After writing your code in a .ts file, you should pass it to the TypeScript Compiler. The tsc produces an equivalent JavaScript source code from the TypeScript file given as an input to it. This process is known as transpilstion.

TypeScript Has The Following Three Components At Its Heart.

1.

Language: Consists of syntax, keywords, and type annotations.

2.

Compiler: Converts the instructions written in TS to its JS equivalent.

3.

Services: Supports the common set of typical editor operations like code completion, code formatting.

Difference

One of the main differences between JS and TS code is a variable declaration. The syntax for declaring a variable in TypeScript is to include a colon (:) after the variable name, followed by its type. Generally, there are 4 ways.
Also, we can add types to each of the parameters and then to the function itself to add a return type. TypeScript can figure the return type out by looking at the return statements, so we can also optionally leave this off in many cases.
If you have any questions, feel free to drop it as a comment or send me a message on Twitter and I'll ensure I respond as quickly as I can. Ciao 👋

introduction

typescript

5

5

1

introduction

typescript

Ravin
JavaScript lover, eats API for breakfast!

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2025. Showcase Creators Inc. All rights reserved.