Tim Mouskhelichvili • November 14, 2022 • 2 minutes to read
If you've been writing TypeScript code for long enough, you've undoubtedly seen occurrences of the double question mark operator. The double question mark operator or nullish coalescing operator helps assign a default value to a null or undefined TypeScript [...]
Tim Mouskhelichvili • November 7, 2022 • 3 minutes to read
One of the more obscure features of JavaScript and TypeScript is the generator function. Many developers have heard about or used it without knowing it, but those who understand it are rare. The generator function goes hand in hand [...]
Tim Mouskhelichvili • November 1, 2022 • 3 minutes to read
If you come from a C# background, you may want to add multiple constructors to a TypeScript class. Although TypeScript doesn't support multiple constructors, you can still achieve similar behavior. In TypeScript, you can achieve a similar behavior to [...]
Tim Mouskhelichvili • October 31, 2022 • 2 minutes to read
Sometimes, a TypeScript developer may want to add a global variable to the code base. Luckily, this is easy to do. To add a new global variable to TypeScript, you can: Augment the global object (when running in a [...]
Tim Mouskhelichvili • October 24, 2022 • 3 minutes to read
When preparing for a coding interview, you may have encountered the queue data structure and wanted to implement it in a TypeScript project. Luckily, this is easy to do. The queue data structure is a list of elements that [...]
Tim Mouskhelichvili • October 17, 2022 • 2 minutes to read
When using object-oriented programming concepts in TypeScript, often a developer needs to make a class implement an interface. Luckily, this is easy to do. To make a class implement an interface in TypeScript, you need to use the special [...]
Tim Mouskhelichvili • October 12, 2022 • 3 minutes to read
To create a read-only property in TypeScript, you need to use the readonly keyword. Here is an example of a read-only property inside an interface: interface IPerson { readonly name: string; role: string; } This article explains everything about [...]
Tim Mouskhelichvili • October 11, 2022 • 2 minutes to read
TypeScript offers multiple loop types to iterate through a piece of code. Some are well known and used a lot, like the for loop. Others are less used, like the while loop. The while loop runs some code while [...]
Tim Mouskhelichvili • October 10, 2022 • 3 minutes to read
Enums are useful when you have a fixed set of constants. Sometimes, a developer needs to transform a TypeScript enum into an array. Luckily, this is easy to do. To transform an enum into an array in TypeScript, you [...]
Tim Mouskhelichvili • October 5, 2022 • 2 minutes to read
In TypeScript, arrays are one of the most useful data structures. They can store a collection of values of any data type. Sometimes, a developer might need to get the last element of an array. Luckily, it is easy [...]