Category "typescript"

localStorage.getItem() doesn't retrieve data on page refresh - ReactJs (TypeScript)

I'm trying to create a to-do list app with ReactJs, working with localStorage the setItem() works fine but the getItem() doesn't return anything except empty ar

createEffect logs reactive updated signal, though dom is not updated with the reactive property

I think this time I've reproduced my issue here. I am using this create_delayed function from previous question, now the createEffect in elevate function logs t

Iterate Object and replace values

I have this Object: { "data": { "success": true, "historical": true, "date": "2022-01-01", "base": "MXN", "rates": { "COFFEE": 0.021

Mikro-ORM disable filter at controller / resolver level

I have two entities and filters with the same name. Note: cond is different for these two entities. @Filter({ name: "myFilter", cond: (args) => ({

Return type of generic function

I'm trying to make getResults function return the proper type, but currently stuck with this: interface IResponse<T> { result: T; } type FnType<P,

How can I add information from a config file when processing a yaml-file with CloudFormationCreateReplaceChangeSetAction?

I have a pipeline with a source stage, build stage, and self-mutate stage. I'm trying to take an existing yaml file and prepare the project it's associated with

typescript infer object value from key

I have a map of components like this: import { Select, Input, DatePicker } from 'antd'; const MyComponentMap = { Select, Input, DatePicker } I'm try

Go JS Tree Mapping view in React TS

I want to achieve Tree Mapping from Gojs in React typescript. I found one example of Go js in react but it's still confusing for me to make Tree Mapping in reac

Angular 7 shared service for siblings component to get data from other sibling

In my Angular 7 app I have two sibling componentns... configurator component and custom stepper component. In configurator component I have some functions that

I am trying to filter on date and reduce the response and do .push to my Data array. But i get error on push cannot assign numbers to strings

This is the the data[] that I want to do push on reduce. const data = [{ 'Date': '', 'AssignedA': 0, 'ConsumedA': 0, 'AssignedB': 0, 'Co

Abstract type classes/interfaces in typescript

Is it possible to have superclasses/interfaces and subclasses/implementations that depict the typing in an abstract way? Lets say you have types and following f

dynamic slug with a static slug - SSR

I have these routing: /blog/slug /blog/search/search-keyword slug is dynamic and search is static and search-keyword is dynamic. but with below structure I got

how to write or change a value in json file with angular

I have this json file. Can I write into this file or change a value without node js just angular? I want to change watch to true is it possible? [ {

How to pass redux props to styled component in react typescript

i'm pretty new to typescript and there's something that is not very clear to me. I'm trying to pass a prop to styled-component file, the prop arrive from redux

Package/bundle a NodeJS application that uses prisma?

I have a typescript project (a small CLI application) that uses prisma. I can compile (tsc) the project and run it (node build/index.js) just fine, but I want t

How to access a specific value in array

I want to access each element of my "to" value of the children property in my array. const items = [{ name: 'Administrateur', children: [ { name:

What input type should I use for code which combines text and numbers? How to declare in TypeScript to avoid errors?

I'm using VueJs (coming from React so I'm new), and I have this input which contains a code => combinations of vowels and numbers. I'm having 2 problems, fir

Pick only two properties from a type in Typescript

I need to pick only two properties whose names are not yet defined from a type, and create a new type from there with one of these properties required and anoth

TypeScript: Extract then Omit from union

Let's say I have a Vehicle union type that looks like that: interface Car { color: string; doors: number; wheels: number; } interface Plane { color: st

Type 'string' cannot be used to index type 'T'

I am wondering what the correct way is to type this? I have tried quite a few ideas and can't make it happy. I have tried <T extends object> (same error)