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 • 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 [...]
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 • September 26, 2022 • 3 minutes to read
Sometimes a developer needs to check the type of a TypeScript interface at run time. Typically, the instanceOf keyword is used for those tasks. Unfortunately, you cannot use the instanceOf keyword on an interface in TypeScript. However, there are [...]
Tim Mouskhelichvili • May 6, 2022 • 3 minutes to read
In TypeScript, interfaces represent the shape of an object. They support many different features like optional parameters but unfortunately do not support setting up default values. However, you can still set up a TypeScript interface default value by using [...]