Category: TypeScript

  • 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…

  • throw new Error – ‘new’ expression, whose target lacks a construct signature

    Throw new Error – ‘new’ expression, whose target lacks a construct signature Published on JS Duck If you have encountered the error message “throw new Error – ‘new’ expression, whose target lacks a construct signature” while using TypeScript, don’t worry, you’re not alone. This error typically occurs when you try to instantiate an object using…

  • Return value depends on argument typescript

    Return value depends on argument typescript When working with TypeScript, you may come across a scenario where the return value of a function depends on the type of argument passed to it. In this blog post, we will explore different solutions to handle this situation. Solution 1: Using function overloading Function overloading allows you to…

  • NestJS, TypeScript and TypeORM error: Error during migration run

    NestJS, TypeScript, and TypeORM Error: Error During Migration Run If you’re working with NestJS, TypeScript, and TypeORM, you may encounter an error during migration run that can be frustrating to debug. In this blog post, we’ll explore the possible causes of this error and provide multiple solutions to help you resolve it. Possible Causes There…

  • How to run script that uses NestJs service

    How to Run a Script that Uses NestJS Service If you are working with TypeScript and NestJS, you may come across a situation where you need to run a script that utilizes a NestJS service. Running such a script can be a bit tricky, but fear not! In this blog post, we will explore different…

  • Typescript: generating an interface object from another interface, using keyof, but renaming the key using a string concatenation

    Typescript: Generating an Interface Object from Another Interface Using keyof, but Renaming the Key Using a String Concatenation As a TypeScript developer, you may often come across situations where you need to generate a new interface object from an existing interface. TypeScript provides a powerful feature called keyof that allows you to extract keys from…

  • Sequelize not working correct with typescript

    Sequelize not working correctly with TypeScript If you’re working with TypeScript and Sequelize, you may have encountered some issues with the integration of these two technologies. In this blog post, we will explore some common problems and provide solutions to help you get Sequelize working correctly with TypeScript. 1. Incorrect type definitions One common issue…

  • Does Playwright Test support globalThis? (typescript/javascript)

    Does Playwright Test support globalThis? (TypeScript/JavaScript) When working with Playwright Test, you may come across the need to access the globalThis object. The globalThis object provides a way to access the global scope, regardless of the environment (browser or Node.js). However, due to the differences in how Playwright Test runs tests, there are some considerations…