DEV Community

Cover image for What is Typescript ? A step by step guide for beginners
swhabitation
swhabitation

Posted on • Edited on • Originally published at swhabitation.com

What is Typescript ? A step by step guide for beginners

In the early 90s, when the web was just beginning to take shape, there was a demand for interactive web pages. People wanted websites that did more than just show static data. JavaScript was born out of this desire.

JavaScript was originally known as Mocha. Later, it was renamed LiveScript and finally became JavaScript. It's a bit confusing, I know 😄

Mocha => Livescript => Javascript

JavaScript was created by a guy named Brendan Eich in 1995 while he was working at Netscape Communications.

Although JavaScript was not the first language to be used for web development, it quickly gained popularity due to its ease of use and its ability to enable web developers to add features such as animations, interactive forms and dynamic content to websites.

In the years that followed, JavaScript continued to evolve and develop, adding new features, fixing bugs and making the language more powerful.

Fast forward to today, JavaScript's influence extends far beyond web development. Its versatility spans across mobile applications, server-side applications, and even desktop software.

Typescript is a modernized version of JavaScript . It includes static typing and more. It wasn’t a complete rewrite of JavaScript; it simply built on its foundations and gave developers the option of a more structured development process.

The history of TypeScript begins in 2012, when Microsoft took the lead in developing it. By adding static typing to JavaScript, TypeScript was designed to improve code maintainability and scalability, as well as improve developer productivity. Since then, it’s gained a lot of traction, especially in large projects where the advantages of static typing are at their best.

Today, TypeScript stands as an example of how constantly web development technologies evolve and adapt.

Why use Typescript ?

Helps Catch Mistakes Early: TypeScript checks your code for errors before executing it. It’s like having a structural engineer check your plan for flaws before starting construction.

Adds Structure to Code: With TypeScript, you can define different data types (e.g. number, string, or custom type) and control how these data types are used. This helps to make your code more structured and readable.

Improves Collaboration: When multiple people are working on a project together, TypeScript helps them understand each other’s code better because it improves readability and consistency.

Enhances Productivity: TypeScript has built-in features such as code autocompletion and enhanced tooling support that can reduce coding time and minimize mistakes.

Maintainability: As the size of your projects increases, it becomes more difficult to manage them all. This is where TypeScript comes in. It offers features such as interfaces and type checking, which make your code easier to keep up with and update over time.

Enhances Code Readability and Maintainability: In addition to TypeScript’s robust typing, it also has features such as interfaces and type annotations that make code easier to read and understand. When someone is reading your code, they’ll be able to easily see the types of data that each variable or function returns and expects. This makes it easier to maintain and understand your codebase over time, which reduces the risk of introducing errors or making unintentional changes when changing existing code.

Types in TypeScript

Image description

Number: This type is used to represent integers such as 1, 2 and 3. It contains both whole numbers (floating-point numbers) and decimal-point numbers.

Example: let myNumber: number = 5;

String: This type is used to represent text or strings of text, such as “hello” or “TypeScript”.

Example: let myString: string = "hello";

Would you like to read the rest of the post? Here it is *How to install cuttlebelle? A Step-by-Step Installation Guide Cuttlebelle

Don't forget to follow us on Medium for more engaging content covering web development and technology!

Would you like to read the rest of the post? Here it is What Is Typescript ? A Step By Step Guide For Beginners

Don't forget to follow us on Medium for more engaging content covering web development and technology!

Top comments (0)