Blog

Page 497 of my articles, tutorials, and thoughts

Latest Articles

Cover Image for Typescript Type "string" is not assignable to type
javascript

Typescript Type "string" is not assignable to type

Published on September 2, 2023

šŸŠšŸŽšŸŒ **Hey there, tech enthusiasts!** šŸ“±šŸ’» Are you getting the error message "Type 'string' is not assignable to type 'Fruit'" when trying to assign a string to a variable of custom type Fruit in TypeScript? šŸ¤” Don't fret! This blog post will guide you

Cover Image for How to watch and reload ts-node when TypeScript files change

How to watch and reload ts-node when TypeScript files change

Published on September 2, 2023

šŸ‘‹ Hey there tech enthusiasts! šŸ‘©ā€šŸ’»šŸ‘Øā€šŸ’» Have you ever wanted to run a development server with TypeScript and an Angular application without having to manually transpile your TS files every time? šŸ¤” Well, you're in luck! šŸ€ In this blog post, we're going

Cover Image for Class type check in TypeScript

Class type check in TypeScript

Published on September 2, 2023

šŸ” Class Type Check in TypeScript: Detecting Classes and Interfaces šŸ” Hey there, tech enthusiasts! šŸ‘‹ Do you find yourself wondering whether it's possible to check if a variable is a certain class or interface in TypeScript? šŸ¤” You're not alone! Many dev

Cover Image for How to reject in async/await syntax?
asynchronousecmascript-2017

How to reject in async/await syntax?

Published on September 2, 2023

# How to Reject in Async/Await Syntax? šŸ˜• So you've just switched your code from using traditional promise syntax to the shiny new `async/await` syntax. You're feeling pretty good about it, but then you run into a problem - how do you properly reject a pr

Cover Image for How to pass optional parameters while omitting some other optional parameters?

How to pass optional parameters while omitting some other optional parameters?

Published on September 2, 2023

# Passing Optional Parameters with Omitted Parameters Do you struggle with passing optional parameters while omitting others? šŸ¤” It's a common issue that often leads to confusion and errors. But fear not, because I have some easy solutions for you! In thi

Cover Image for How do I decide whether @types/* goes into `dependencies` or `devDependencies`?

How do I decide whether @types/* goes into `dependencies` or `devDependencies`?

Published on September 2, 2023

# How to decide whether @types/* goes into `dependencies` or `devDependencies`? šŸ¤” So you're working on a TypeScript project and you want to add typings for a JavaScript library using the `@types` syntax. Great! But you're wondering whether these typings

Cover Image for How to declare a type as nullable in TypeScript?

How to declare a type as nullable in TypeScript?

Published on September 2, 2023

šŸ“£ Hey there, tech enthusiasts! šŸ˜Ž Ready to dive into the world of TypeScript? šŸš€ Today, we'll tackle a common question that many TypeScript developers may have encountered: "How to declare a type as nullable in TypeScript?" šŸ’” šŸ”Ž Let's start with a scena

Cover Image for Check if value exists in enum in TypeScript
enumsjavascript

Check if value exists in enum in TypeScript

Published on September 2, 2023

# Check if value exists in enum in TypeScript: A Simplified Guide šŸ˜Ž If you've ever had to check if a value exists in an enum in TypeScript, you're not alone. It can be a bit tricky and cumbersome to achieve this with clean, readable code. But fear not! I

Cover Image for Use async await with Array.map
async-awaitecmascript-2017javascriptpromise

Use async await with Array.map

Published on September 2, 2023

# Using async/await with Array.map: A Complete Guide šŸ˜ŽāœØ Do you find yourself scratching your head and wondering why `async/await` and `Array.map` don't seem to play nicely together? Don't worry, you're not alone! Many developers, especially those new to

Blog | Matheus Mello