Category "typescript"

How to await for an aync function in a for loop? [duplicate]

I have an aysnc function which loop thru an array, make another aync call for each element, wait for result. public async myfetch(parent_id: s

Typo3 Simple Template for BackendLayout

I am programming on a new Site with Typo3 and I am using BackendLayouts for the style, but it shows just the Main-Content (number 0). I don't understand the doc

TypeScript literal number type not being calculated [closed]

I'm confused with such behavior: TS Playground. type N = 1 | -1 | 0 // Type 'number' is not assignable to type 'N'. function test_3(arg: N):

Should exported types always be moved to seperate file?

I don't like the idea of having a file with both export type SomeType ... etc. (can be multiple) and an exported class. But my colleague argues that its a desir

Cache manegment in recoil js

I decided to try using recoil instead of redux and ran into the problem of caching mutable collections. To be more precise, the problem is not in the response c

React build suddenly fails inside Docker image

This error is only happening inside a Docker image build: TypeScript error in /app/src/index.tsx(12,10): 'Provider' cannot be used as a JSX component. Its ins

Problem in serverless function (serverless framework) when using sequelize orm to make requests to the database

I’m trying to set up a simple serverless environment using serverless framework, there is only one lambda function that makes a call to the database using

what should be the default value of file in react-typescript in useState

How do I initialize a file through useState in React Typescript? const [images, setImages] = useState<File>(); const [formData, setFormData] = useSt

generic type to add missing properties in type

I have the onMessage function that gets events from SDK of the third party in my app interface TypeA { a:string, b:undefined } interface TypeB{ b: '

In Typescript "keyof Record<string, string>" is not "string"

I'm hitting this wall since days now and I'm not sure anymore if I'm the problem or if typescript is broken... I defined a generic class with the generic extend

type obj values by enum keys (TS)

I have an object with 2 types of values: str and num. I want to type all properties without duplicating of type name. const obj: any = { num1: number; num2:

Why does a proprety call {{hero.name}} work in a <h> but not in a <img>

In the template, the following code works normally: <h3>{{hero.name}}</h3> or even: <a routerLink="/details/{{hero.id}}">{{hero.name}}</a&

Implement Func<T,TResult> delegate in Typescript

Fairly new to the node ecosystem and Typescript. I am looking for how to implement an abstract delegate Func<T,TResult> in Typescript. A C# Example of wh

TypeScript. The function accepts two different objects, but returns one object

I am beginner in TypeScript. I am developing a home project - a weather application, I have two requests to the server, the responses are almost identical, exce

Get error when using createContext with typescript

I am trying to make a context with hooks in react with typescript like this: // StateGlobalContext.ts import React, { Dispatch, ReactNode, SetStateAction } from

Validate typescript definition files for errors programatically

I am generating typescript definition files programmatically. Sometimes an incorrect definition file will be generated from user error. This cannot be changed a

Set the date value to the mat Input date picker in Angular TS

I have a requirement to read the query parameter for date and set the value of the Mat Input value to the value read by the query parameter. I am using Mat date

How can I get Toast-UI editor content?

I am a student studying. I think I'm doing it conceptually wrong. I'm trying to use vue3 and type script and I'm going to use Toast-UI editor. I get an error. r

Custom utility types (generic types) for classes `IsClass` of TypeScript

I am trying to create a generic type to make sure the first parameter to be a class. However, the factory function parameter cannot be replaced by a generic typ

this.activatedRoute.params is undefined in Angular

I have routing in app-routing.module.ts I want to get playerId and teamId from the router but it returns undefined in the console as I subscribe to it in AppCom