Typescript Iterate Over Records

Typescript Iterate Over Records

Recently, I was working on a TypeScript project where I had to iterate through a Record object that stored user information with unique IDs. The issue is that there are multiple ways to iterate over a record in TypeScript, and each method has its own advantages and disadvantages. In this article, I will cover five … Read more >>

Mapped Types in TypeScript

TypeScript map Object Type

While building a TypeScript app, I got an error caused by accidentally modifying data fetched from an API. To avoid such issues in the future, I used Readonly and other mapped types. It helped me to avoid the error by making parts of the data unchangeable. In this TypeScript tutorial, I’ll explain mapped types in … Read more >>

Exception Handling in TypeScript

Exception Handling in TypeScript

While developing a TypeScript-based web application, you created a feature that fetches user data from an API. Sometimes, the API is down or returns an error. To handle such cases without crashing the app, you used a try-catch block inside an async function. This way, if the API call fails, you can display an error … Read more >>

TypeScript Classes: Concepts, Syntax, and Examples

TypeScript Classes

While I’m working on a web application, I needed a way to manage users, including storing their names, emails, and roles, and updating their details as required. Instead of writing the same code again and again for each user, I decided to use a TypeScript class. It helped me organize the code, add useful methods, … Read more >>

Deep Clone an Object in TypeScript

deep cloning in TypeScript objects

When working with objects in TypeScript, sometimes a complete copy of an object is needed, including all its nested properties. When we copy an object along with its related properties, it is referred to as deep cloning. Without deep cloning, if you change a nested property in the copied object, it might also change the original … Read more >>

How to Check if an Object Has a Property in TypeScript

Method to Check Typescript object property

Recently, I was working on a feature using TypeScript that required displaying user details retrieved from an external API. In that, I got an unexpected error of undefined values for some optional fields. For this, it was required to check whether those properties actually existed on the object before using them. TypeScript provides several ways … Read more >>

Define and Use an Empty Object Type in TypeScript

Define and Use an Empty Object Type in TypeScript

While building a TypeScript function, you might want to accept an object as a parameter, but you don’t care what properties it has; you want to make sure it’s some object and not a string, number, or null. For example, you are writing a logging function that accepts any object and prints it to the … Read more >>

How to Use Index Signature in TypeScript?

Index object with string in typescript

I was working on a TypeScript project that tracked the status of different cities. There, I got a challenge that the list of city names kept changing, and I didn’t know all the keys ahead of time. At first, I tried using a loose object type, but that quickly led to confusion and potential errors. … Read more >>

Unknown vs Any in TypeScript

Unknown type in TypeScript

While working on a TypeScript project, I had to deal with data coming from an external source, and I wasn’t sure what type it would be. At first, I used any type to make things easier, but it quickly caused errors that TypeScript didn’t catch. That’s when I looked into the unknown type. It seemed … Read more >>

Difference Between Namespaces and Modules in TypeScript

Namespaces and Modules in TypeScript

While building an online shopping app in TypeScript, you first use namespaces to group code like Customer, Product, and Order in one file. It works fine for small projects. However, as the app grows, you can switch to modules to split code into separate files using export and import, making it easier to manage. TypeScript, … Read more >>

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.