Category: TypeScript
-
Octokit issue in React environment with typescript
Octokit issue in React environment with TypeScript When working with React and TypeScript, you may encounter issues when using Octokit, a popular GitHub API client library. This blog post will explore the common problems faced and provide solutions to overcome them. Problem: Type errors when using Octokit in a React component One common issue is…
-
How to create type predicate to check for 2 types of setState in react?
How to Create a Type Predicate to Check for 2 Types of setState in React When working with React and TypeScript, it’s common to use the setState function to update component state. However, there are situations where you might want to restrict the types of values that can be passed to setState. In this blog…
-
TypeScript errors using Multer in Express app
TypeScript errors using Multer in Express app If you are working with TypeScript and trying to use Multer in your Express app, you may encounter some TypeScript errors. Multer is a middleware that allows you to handle multipart/form-data, which is commonly used for file uploads. In this blog post, we will explore the common TypeScript…
-
You need to provide a parserOptions.project for Eslint
You need to provide a parserOptions.project for Eslint If you are using Eslint to lint your TypeScript code, you might have come across the need to provide the parserOptions.project configuration option. This option is used to specify the path to your TypeScript configuration file (tsconfig.json) so that Eslint can understand your project’s TypeScript settings and…
-
Fail to connect database to Typescript ES module
Fail to connect database to Typescript ES module When working with TypeScript ES modules, you may encounter issues when trying to connect to a database. This can be frustrating, but fear not! There are several solutions to this problem that you can try. Solution 1: Using a Database ORM One way to connect your database…
-
Typescript Conditionally extending an “Array or Object” not working as expected
Typescript Conditionally extending an “Array or Object” not working as expected Typescript provides powerful features for creating and manipulating complex data structures. However, there are times when we need to conditionally extend an “Array or Object” in Typescript, and it may not work as expected. In this blog post, we will explore this issue and…
-
Running Typescript workspaces with transpiled internal packages
Running TypeScript Workspaces with Transpiled Internal Packages When working on large TypeScript projects, it is common to organize the codebase into multiple packages or modules. This helps in maintaining a clean and modular code structure. However, when it comes to running TypeScript workspaces with transpiled internal packages, it can be a bit challenging. In this…
-
cannot find module react/jsx-runtime – when using react 17 with typescript
Cannot find module react/jsx-runtime – when using React 17 with TypeScript If you are encountering the “Cannot find module react/jsx-runtime” error while using React 17 with TypeScript, don’t worry, you’re not alone. This issue often occurs when you have upgraded to React 17 and are using TypeScript, as React 17 no longer includes the jsx-runtime…
-
Typescript mapped type with filtered keys
Typescript Mapped Type with Filtered Keys When working with TypeScript, you may come across a situation where you need to create a mapped type that includes only certain keys from an existing type. This can be achieved by using a combination of mapped types and conditional types in TypeScript. Let’s say you have an existing…
-
Angular/typescript cant access values set inside promise then/catch
Angular/TypeScript: How to Access Values Set Inside Promise then/catch When working with Angular and TypeScript, you may encounter situations where you need to access values that are set inside a Promise’s then or catch block. Promises are commonly used for handling asynchronous operations, such as making HTTP requests or querying a database. However, accessing these…