TypeScript Environment Setup

There are two popular options available for writing TypeScript code: Online Playground Typescriptlang.org provides a web page where we can immediately write and see JavaScript output on a web page. You can click on the Playground link. In the left section of the page, we can write our TypeScript code, and …

TypeScript Environment Setup Read More

Typescript Data Types

In this TypeScript tutorial, we will learn about TypeScripts data types. Data types helps you to write code just like you write in other OOPS languages like C# and Java. Data Types provides strongly typed code. A strongly typed code means all variables data types are known at compile time. Strongly typed code helps …

Typescript Data Types Read More

TypeScript Union Type

TypeScript Union Type is a hint to the compiler for possible data types for a variable. We use the union data type when we are not sure about the possible variable data types, but we know that the possible data types are limited. For example, we have a function named …

TypeScript Union Type Read More

TypeScript Switch Case

A switch case statement is used when we have to execute between different blocks of code based on a condition. It replaces the need for multiple if…elseif conditions and provides more clean code. Switch evaluates an expression and then matches it with different case clauses. If any value matches the case clause, …

TypeScript Switch Case Read More

Typescript Optional Parameters

TypeScript optional parameters allow you to declare some parameters in the function optional, so that clients do not need to pass values to optional parameters. TypeScript is a strong typed language. When we declare parameters for a function, all the parameters are required, and the client has to pass values to every …

Typescript Optional Parameters Read More

TypeScript Rest Parameters

TypeScript Rest parameters allows a function to take unlimited parameters. Rest parameters are used when we are designing a function and we do not know how many parameters are required. Rest parameters feature group parameters into a single variable and we can access parameters inside a function just like an …

TypeScript Rest Parameters Read More

TypeScript Interfaces

In this tutorial, we will learn about TypeScript Interfaces. An interface defines what members (properties, functions) an object must have. For example, we define that a interface ICar has two properties ‘make’, and ‘name’ then all objects which implements this interface must have these two properties. In TypeScript interface, we can define …

TypeScript Interfaces Read More

TypeScript Abstract Class

A TypeScript Abstract class is a class which may have some unimplemented methods. These methods are called abstract methods. We can’t create an instance of an abstract class. But other classes can derived from abstract class and reuse the functionality of base class. TypeScript Interface vs Abstract Class Interface Abstract Class All …

TypeScript Abstract Class Read More