Tim Mouskhelichvili • January 16, 2023 • 4 minutes to read
An array is one of the most frequently used foundational data structures in programming. But what is it exactly, and how does it work in TypeScript? In TypeScript, an array is a structure that stores values in sequential order [...]
Tim Mouskhelichvili • January 9, 2023 • 5 minutes to read
TypeScript, just like many modern object-oriented languages, allows a developer to create an interface. But what is it, and how to use it? An interface is a contract structure that defines the syntax that a class or object must [...]
Tim Mouskhelichvili • January 3, 2023 • 4 minutes to read
If you come from an object-oriented language like Java or C#, you may be surprised that JavaScript doesn't support the enum data type. Luckily, our favorite TypeScript supports it. An enum allows the declaration of a set of related [...]
Tim Mouskhelichvili • December 26, 2022 • 3 minutes to read
When developing TypeScript projects, developers often need to check the type of an entity. Luckily, this is easy to do. This article shows how to check the type of: A variable An object An interface A class An array [...]
Tim Mouskhelichvili • December 20, 2022 • 3 minutes to read
When using TypeScript, developers often need to replace placeholders with values inside a string. This operation is called string interpolation. To perform string interpolation in TypeScript, create a template literal like so: const age = 20; console.log(`Your age [...]
Tim Mouskhelichvili • December 13, 2022 • 3 minutes to read
Nowadays, an arrow function is the default and easiest way to define a function in TypeScript and JavaScript. But how does it work exactly? Here is an example of an arrow function in TypeScript: const sum = (x: number [...]
Tim Mouskhelichvili • December 12, 2022 • 2 minutes to read
Sometimes, a TypeScript developer wants to make an arrow function accept different types. That's where generic functions come into play. To make an arrow function generic, you need to add a generic parameter to it like this: const getX [...]
Tim Mouskhelichvili • December 5, 2022 • 4 minutes to read
If you are writing TypeScript code long enough, you have seen the declare keyword. But what does it do, and why use it? The declare keyword tells the TypeScript compiler that an object exists AND can be used inside [...]
Tim Mouskhelichvili • December 3, 2022 • 2 minutes to read
Often, a TypeScript developer needs to define an array of objects. Luckily, this is easy to achieve. In TypeScript, to define an array of objects, you can: Use an existing type or interface. Use an inline type. Use the [...]
Tim Mouskhelichvili • November 21, 2022 • 3 minutes to read
When working on a TypeScript project, a developer sometimes needs to modify an existing interface by adding one or more members. Luckily, this is easy to do. To extend an interface in TypeScript, you must use the extends keyword [...]