Book Your Free Call
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 [...]
Tim Mouskhelichvili • October 4, 2022 • 2 minutes to read
When developing a web application or TypeScript library, a developer may need to initialize an empty typed object. Luckily, it is easy to achieve. To initialize an empty typed object in TypeScript, you can: Use type assertionCreate a new [...]
Tim Mouskhelichvili • October 3, 2022 • 2 minutes to read
When declaring an empty array in TypeScript, the compiler cannot infer its type by default. That's why you need to specify the array's type explicitly. Luckily, it is easy to do. Here is one way to declare an empty [...]
Tim Mouskhelichvili • September 28, 2022 • 3 minutes to read
TypeScript adds strong typings to your JavaScript. Everything has its type in TypeScript. However, the compiler is sometimes incorrect and infers the wrong type. Luckily, TypeScript offers a special keyword to cast object types. The as keyword converts an [...]
Tim Mouskhelichvili • September 27, 2022 • 2 minutes to read
Sometimes, a TypeScript developer may need to find the class name of an object. Luckily, it is easy to do. To find the class name of an object at runtime in TypeScript, you can: Use the constructor property of [...]
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 • September 22, 2022 • 2 minutes to read
Sometimes, when developing a TypeScript project and importing a new package, you get a "cannot find module" error. Luckily, this error is easy to fix. There are many reasons why the "cannot find module" error can happen in TypeScript: [...]
Tim Mouskhelichvili • August 3, 2022 • 3 minutes to read
If you come from a computer science object-oriented programming background, you may want to utilize some of the design patterns you've always used but in TypeScript. One of the most well-known design patterns is the singleton. A singleton is [...]
Tim Mouskhelichvili • August 2, 2022 • 3 minutes to read
When working on a TypeScript repository, developers want to keep the files short, making it easier to navigate the code and debug. This leads to the TypeScript repository having many different files. For those TypeScript files to work together [...]
Tim Mouskhelichvili • August 1, 2022 • 3 minutes to read
The TypeScript compiler is excellent at showing errors and warning when it detects something is wrong with the code. Sometimes, however, a developer may want to ignore an error on the next line AND still compile the code. Luckily [...]