Category "typescript"

react-xarrows not updating lines in position

There are some issues I'm having while using the react-xarrows with mui. I'm trying to achieve: The line should be connected in the same position after toggling

WebdriverIO: automating native upload window that opens on button click in electron

I am trying to automate file upload in Electron, but Native upload is used that is open when the upload button is clicked, so there is no input element to set t

Why is onClick misbehaving and sometimes not showing data behind it?

New to typescript and have been using it for 2 days now mainly to build a custom component for my streamlit app. I have created the below navigation bar and the

Typscript Error on Class Constructor - No index signature with a parameter of type 'string' was found on type 'BarberModel'

I have a class constructor and I want populate it with an object that I receive in constructor. But I don't know how to solve this TS error on line this[key] =

Build a dynamic interface for Object in angular

I have an JSON Object received from an api call and the Object will have multiple values but all of type string. How to I write an Interface for such an Object

How to create generic that extends union type of class programaticaly

I have following the code: const events = { a: ['event1' as const, 'event2' as const], b: ['event3' as const, 'event4' as const], }; class SomeClass<

Creating service in React Typescript using axios

There are two different ways to create a service and call from the required funtional component. 1. export const userProfileService = { ResetPassword: asyn

Differentiating custom Typescript Interfaces that have the same fields

I have a custom interface like this: interface Pointer<T> { id: string } id is a pointer to other data structures, but the id field doesn't contain inf

TypeScript Mapped Type - Convert type properties to instances of type

I am trying to convert an object full of class constructors to a mapped object with properties that are functions that return an instance. For example: // From

What does this mean in angular, what kind of type is this?

I would like to know what this type means: type newtype = (state: EntityState<IEntities>) => IEntities[];

Define an "extends string" type that doesn't allow union of strings

I have this function function something<T extends string>(): void { // ... } I would like to restrict T to be a SINGLE string, and not a union of strin

cls-hooked: AssertionError [ERR_ASSERTION]: context not currently entered; can't exit

I'm currently deploying an express app to Heroku. I'm using cls-hooked to set request ids for each request. This works perfectly on my local machine and inside

What's the ideal way to add set data to a database in Nest.JS when starting the app for the first time?

I have a database with quite a few tables, and some of those tables need to have default information in them - stuff like categories, permissions, roles, tags,

Is there a way to keep type inference in union types from type guards inside a function?

Let's say I have three types (and a union one) type A = { type: 'a' title: string description: string } type B = { type: 'b' title: string

Nested object from an array using lodash in typescript

My Data structure reads this {property: ["a","b"] , value : "somevalue" , comparision : "somecomparison"} I want to create a object out of it like { "propertie

Do these two snippets return the same value?

I'm not sure how to title this question, but it's concerning a pattern where the || operator is used to resolve a sequence of undefined values to the first defi

ESLint rules for no-unused-enums

There's a no-unused-vars eslint rule that can warn/error if a variable is unused: https://eslint.org/docs/rules/no-unused-vars If I want to ensure that there ar

Typescript: deep keyof of a nested object

So I would like to find a way to have all the keys of a nested object. I have a generic type that take a type in parameter. My goal is to get all the keys of

How to add typescript paths to storybook

I have a react application with a custom Webpack configuration. After adding Webpack aliases that matches tsconfig.json file compilerOptions->paths field the

TypeScript: How to replace a particular number in a string (a combination of numerical and non-numerical values), and then update its value?

I asked a similar question here TypeScript: How to replace a particular number in a string, and then update its value? Really appreciate the answers there. It a