TypeScript while

In this tutorial, you will learn how to create a loop using the TypeScript while statement. Introduction to the TypeScript while statement The while statement allows you to create a loop that executes a block of code as long…

TypeScript for

 In this tutorial, you will learn about the TypeScript for loop statement that executes a piece of code repeatedly. Introduction to the TypeScript for statement The following shows the syntax of the TypeScript for loop statement: The for loop statement creates…

TypeScript switch case

 In this tutorial, you will about the TypeScript switch…case statement. Introduction to TypeScript switch case statement The following shows the syntax of the switch…case statement: How it works: First, the switch…case statement evaluates the expression. Then, it searches for the first case clause whose…

TypeScript if else

In this tutorial, you will learn about the TypeScript if…else statement. TypeScript if statement An if statement executes a statement based on a condition. If the condition is truthy, the if statement will execute the statements inside its body: For example,…

TypeScript Type Inference

In this tutorial, you will learn about the Type inference in TypeScript. Type inference describes where and how TypeScript infers types when you don’t explicitly annotate them. Basic type inference When you declare a variable, you can…

TypeScript String Literal Types

In this tutorial, you will learn about the TypeScript string literal types that define a type that accepts a specified string literal. The string literal types allow you to define a type that accepts only…

TypeScript union Type

In this tutorial, you will learn about the TypeScript union type that allows you to store a value of one or several types in a variable. Introduction to TypeScript union type Sometimes, you will run…