Shubham Vora has Published 962 Articles

What are type guards in typescript?

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 16:20:34

3K+ Views

In TypeScript, the type guards are used to determine a variable's type, often inside a conditional or functional block. The type guards usually take the variable and return a Boolean value or the variable type. Type guards allow you to tell the TypeScript compiler to infer a given type for ... Read More

Method Overriding in TypeScript?

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 16:17:06

12K+ Views

The method overriding means writing the new definition of the method in the inherited class by keeping the method name, parameters, and return type the same. In this tutorial, we will learn about the method overriding in TypeScript. Inheritance is one of the four pillars of object-oriented programming. The method ... Read More

How to use getters and setters in TypeScript?

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 16:06:17

8K+ Views

In TypeScript, the getters and setters are two terms that can be used to get and set the value of the class members, respectively. However, users can access the public members of the class directly via the dot operator by taking the object of the particular class as a ... Read More

How to sort a 2D array in TypeScript?

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 16:03:46

4K+ Views

In TypeScript, a 2D array is an array of arrays, where each inner array represents a row of the 2D array. You can access individual elements of the array using bracket notation, with the row and column indices separated by a comma. A single-dimensional array can store values of ... Read More

How to push an element to the last of an array in TypeScript?

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 16:02:09

2K+ Views

In TypeScript, an array is a data type that represents a collection of elements. Each element in the array has a specific index, or position, in the array, and you can access or modify the elements in the array using their index. In TypeScript, an array can contain elements of ... Read More

How to find the length of a string in TypeScript?

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 15:56:59

4K+ Views

The string can contain a sequence of repeated and non-repeated characters. The length of the string means the total number of characters the string contains in the sequence of characters, including special characters, alphabetic characters, etc. Here, we will learn different methods to calculate the length of the string in ... Read More

Handling Errors in TypeScript

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 15:53:39

6K+ Views

Functional programming languages such as TypeScript and JavaScript provide a way to handle errors using the try-catch blocks. The try block catches the errors, and the catch block handles the errors.  In this tutorial, we will learn to handle errors in TypeScript. There are mainly 7 types of errors in ... Read More

How to use property decorators in typescript?

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 15:49:48

3K+ Views

Decorators in TypeScript have programmatic access to the class definition process. Remember that a class description lists a class's properties, specified methods, and structure. The class instance is given access to these properties and methods when created. However, before a class instance is created, decorators allow us to add code ... Read More

What are Intersection Types in typescript?

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 15:38:09

1K+ Views

In this tutorial, we will learn what are Intersection types in TypeScript. With the help of TypeScript, we may mix various types to produce more comprehensive and effective use cases. You can learn how to build union and intersection types more effectively in TypeScript by knowing the design concept behind ... Read More

How to implement class constants in TypesScript?

Shubham Vora

Shubham Vora

Updated on 19-Dec-2022 15:35:50

1K+ Views

In this tutorial, we will learn to implement class constants in TypeScript. Any application has shared values that need to be used by classes and modules. These numbers could be configuration parameters, environment settings, error codes, or status indications. Using constants to hold those values rather than hard-coding magic strings ... Read More

Advertisements