Tim Mouskhelichvili • May 17, 2023 • 2 minutes to read
Sometimes, when developing a TypeScript project, a developer may need to extract types from a union type. Luckily, this operation is easy to do with the built-in Extract utility type. The Extract<Type, Keys> utility type constructs a new [...]
Tim Mouskhelichvili • May 1, 2023 • 2 minutes to read
Sometimes, when developing a TypeScript project, developers need to exclude a member from an existing union type. Luckily, this operation is easy to do, using the Exclude utility type. The Exclude<UnionType, ExcludedMembers> utility type, constructs a new type [...]
Tim Mouskhelichvili • April 29, 2023 • 2 minutes to read
Sometimes when developing a TypeScript project, developers need to manipulate existing union types and remove null and undefined. Luckily, this task is easy to accomplish using the NonNullable type. The NonNullable<Type> constructs a new type by excluding null [...]
Tim Mouskhelichvili • April 17, 2023 • 2 minutes to read
TypeScript offers many utility types to help developers work better with types. One of them is the ReturnType utility type. But what is it, and how does it work? The ReturnType utility type helps you create a new type [...]
Tim Mouskhelichvili • April 10, 2023 • 2 minutes to read
When developing a TypeScript project, developers often need to convert a string to a boolean. But how do you do it? This article shows multiple methods to convert a string to a boolean in TypeScript with code examples. Let's [...]
Tim Mouskhelichvili • March 31, 2023 • 2 minutes to read
When developing a TypeScript project, developers often need to make a property optional inside an interface, type, or class. Luckily, this is easy to do. To mark a property as optional in TypeScript, you can place a question mark [...]
Tim Mouskhelichvili • March 24, 2023 • 2 minutes to read
When creating a TypeScript project, developers often need to merge objects. But how do you do it? To merge objects in TypeScript, a developer can: Use the spread operator Use Object.assign Use the Lodash merge function This article [...]
Tim Mouskhelichvili • March 17, 2023 • 2 minutes to read
Sometimes when developing a JavaScript/TypeScript project, you might get the "type annotations can only be used in typescript files" error. But what does it mean, and how to fix it? This article explains everything about this error and shows [...]
Tim Mouskhelichvili • March 10, 2023 • 2 minutes to read
In programming, comments are a great way to add explanations to a piece of code, making it more readable and maintainable. But how do they work in TypeScript, and what is their syntax? In TypeScript, you can create two [...]
Tim Mouskhelichvili • March 6, 2023 • 2 minutes to read
TypeScript provides support for many primitive data types. One of them is the boolean type. This article explains the boolean data type in TypeScript and shows many code examples. Let's get to it 😎. Summary The definition The boolean [...]