Category "typescript"

How to create a test Unit method for a get request that fetches Data from Database(MongoDB)?

Get request method in tasks.js file const { Task } = require('../model/Tasks.js') const asyncWrapper =require('../middleware/async') const getTask = asyncWrapp

Object with Unpredictable Fields in TypeScript Interface

I am working on a web application in Angular and am making the following call to a service return this.http.get<SiteContent>(this.apiUrl + this.endpoint +

How to access Axios error response object in catch clause?

I recently upgraded to axios 0.23.0 and I am now receiving an error when trying to access the error response object in a catch clause. This is where I am gettin

Unable to get rid off this "The 2 extension(s) below, in workspace recommendations have issues" message in VS Code

I am on Mac M1 and the VS Code version installed is 1.67.0 Here is the screenshot: image How to get rid of it? I have tried to restart the VS Code multiple time

Generic type parameter extending type "any" is not of type "any" anymore

I was not able to find an answer to the question why function thisDoesNotWork causes an error. In contrast, function thisWorks transpiles the line anyArgs.whate

TypeScript: Code to sum values in one column based on the value in another column in Excel

I am new to TypeScript and my goal today, would be to sum up all the cell values in a column in an Excel file, based on the cell values in an another column. In

Node js with typescript; How to catch express errors

So if I am using node js with javascript, I used to catch errors by adding the following code in my app.js startup file: app.use((req, res, next) => { next

Jest database setup before any test suits are run

I'm trying to seed my entire database for all the necessary resources that need to be present to test my API successfully. My tests are in several files. How ca

React fordwardRef with typescript

I have forwarded ref using React forwardRef below is my code: interface PropsDummy {} const ProfileMenu = forwardRef<HTMLInputElement, PropsDummy>((props

Custom Provider: Object literal may only specify known properties, and 'provide' does not exist in type

I'm trying to replace my logger provider in a unit test file with a stubbed provider so that I don't get logs during unit tests from the tested module. I'm gett

How can i await for file to upload so i can upload next image with params

I am using Drag and Drop file to upload multiple images. ngx-file-drop How to use with async await to upload images because i want to send params to next image

How to import DateTimeFormatOptions in

I want to store a DateTimeFormatOptions for date.toLocaleString() to use in multiple places in my app. I defined it like: export const timeFormat = { month: 'nu

Type 'AppOneType | AppSecondType' is not assignable to type 'AppOneType'

This is my current code structure: interface AppOneType { ... } interface AppSecondType { ... } interface HomeType { data: AppOneType; } interfac

Module does not provide an export named default - compiled typescript module

I'm developing a node npm module in typescript, and after I compile it to commonjs and try to import it, I get the error: SyntaxError: The requested module 'woo

Google Picker API - showing only files user can share

I would like to use the Google Picker to choose a specific file from Drive, get its id and then share it with some other accounts using Drive API. The problem i

Property 'isMounted' does not exist on type 'ErrorBoundary'

I'm practicing typescript and I've run into this bug that won't let me move forward: Property 'isMounted' does not exist on type 'ErrorBoundary'. I have the fol

How can a type of a class field that is unknown at instantiation be inferred?

Here's a class example: class Foo { item: unknown constructor(item: unknown) { this.item = item } getItem(): typeof this.item { return this.i

Interface keys from array in TypeScript

Is there a way to enforce the keys of an interface to be used from an array of strings: E.g. If we have the following array: const myArray = ['key1', 'key2'];

How to remove the selected data from saved data when we click on button in a selected one

In my application I have saved the data when we click on it(we can add the multiple data by entering some data and save the multiple data by clicking the save b

Migration from dataSource get the error: Cannot execute operation on "default" connection because connection is not yet established

My typeorm version is 0.3.6. Whenever i tried to use dataSource.runMigration() i get this error, MIGRATION ERROR:CannotExecuteNotConnectedError: Cannot execute