Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
149 views

"Pass" generic type to another generic type [duplicate]

Anything new since : Is it possible to pass generic type as generic parameter? ? My specific problem : This work fine type isArrStr<T extends readonly string[] > = T extends readonly["str&...
issueWebpack's user avatar
2 votes
1 answer
121 views

How can I omit interface by union type recursively in typescript?

I'd like to omit recursively by type that includes in union types, and remove some union types Here's the example. Normal and Admin must be union types interface Admin { admin: never; } interface ...
saroro's user avatar
  • 21
0 votes
1 answer
135 views

Extract href from string and again bind the updated data to the element in Angular

I am getting one string like this in innerHtml <div class="wrapper" [innerHTML]="data.testString"> data.testString contains data like below, data.testString="<p>...
Explorer's user avatar
  • 371
0 votes
1 answer
275 views

this keyword in class method as a function parameter in typescript

Tried to pass this with type in a class method and then try to access it in 2 ways: Create a new JS object and assign a value. (No Error) {getName: obj1.getName} in below code Save it to a new ...
Rajat Jain's user avatar
  • 1,409
0 votes
0 answers
19 views

mongoose problm uri parameter

at C:\Users\ELCOT\Desktop\chats app backend\chatsappbackend\chat-backend\node_modules\mongoose\lib\index.js:351:10 at C:\Users\ELCOT\Desktop\chats app backend\chatsappbackend\chat-backend\node_modules\...
Ranjith Kumar's user avatar
1 vote
0 answers
56 views

How do I get conditional types to show proper error for required props

I have a simple component and two of the props are conditional based on the existence of the other. It is simple enough to get this working, however the error message for the other required prop seems ...
Aaron Balthaser's user avatar
0 votes
0 answers
63 views

Template literals cause lost type information in mapped object

I have run into a seemingly intractable problem with a tool I am writing. The tool allows defining all action types, actions, selectors, and reducer functions based on the shape of an initial state ...
Joshua Dannemann's user avatar
0 votes
1 answer
460 views

How do I declare a temporary variable in angular html component?

I am trying to call a function inside a loop. How do I call a function and store the return value as temporary variable? I need to use the return value to display. Sample below code I want to achieve. ...
Anthony Cuartero's user avatar
0 votes
0 answers
260 views

TypeScript tree typization

Below is a short example of a tree interface TemplateRoot extends Template {} class Template { #root: TemplateRoot | undefined get root (): TemplateRoot { return this.#root ?? this } ...
Turar Abu's user avatar
  • 368
-1 votes
1 answer
68 views

Failed to implement Typescript function overload

Following the last question: Typescript: omit undefined/null properties from type Using TS, I was trying to implmenet an overload for a function named request which can accept payload or not, by the ...
Itay Elkouby's user avatar
0 votes
1 answer
979 views

Extend/Omit interface in typescript

I have list of props under interface type. And want to extend interface type with modification as below, Change of Prop types addition of new fields interface Request { Id: NullProp<number>...
user3711357's user avatar
  • 1,585
1 vote
1 answer
56 views

TS2322: Type '{ headers: HttpHeaders; body: Stock[]; } | null' is not assignable to type 'Stock[]'

I am getting this TypeScript error in Angular. I have a class named StockComponent with the following property: protected stocks: Stock[] = []; The Stock class is a regular class I created to ...
Singleton's user avatar
0 votes
0 answers
131 views

ThreeJS animation not running in Typescript Eslint5 Next Application

I have a typesafe typescript application running on next and need to implement an "old" three.js animation I built for a react project. Since typescript is a bit tricky with getting document ...
s1xp4c's user avatar
  • 11
0 votes
0 answers
312 views

semantic error TS2574: A rest element type must be an array type

Here is the code src/object.ts(50,58) interface sanitizer<T> { (val: T): T } type MapSanitizor<T extends any[]> = T extends [infer P, ...(infer R)] ? [sanitizer<P>, ......
Panth's user avatar
  • 45
0 votes
1 answer
57 views

join grid column not available in vaadin hilla using Lit?

in vaadin hilla grouping column header is working fine whereas joining column under one header not working. vaadin 14 had option for joining 2 columns which is lacking in hilla. if anyone has any ...
Archana's user avatar
-1 votes
1 answer
99 views

How can I use date-fns to format a date from an API?

I receive data from an API in the format 'yyyy-MM-dd'. I would like to convert this date to 'dd-MM-yyyy'. When I specify this notation my table will not be displayed. How could I change the format in ...
Saturday Sun's user avatar
-2 votes
2 answers
951 views

How to add variable as key name in typescript interface?

This is how my object would look like. This is very small version of object and I have to deal with large object. const obj = { name: 'name_key', details: 'details_key', profile: '...
Manish Rathod's user avatar
1 vote
1 answer
2k views

Test Observable with fakeAsync, delay and tick using Jasmine

I have a pipe that helps return the state of an observable. import {Pipe, PipeTransform} from '@angular/core'; import {Observable, of} from 'rxjs'; import {catchError, map, startWith} from 'rxjs/...
prasuna_16's user avatar
1 vote
1 answer
220 views

How To scroll to the last message in the react virtualization message container

I am using scrollToIndex and scrollToRow but is not working on adding a new message, Also I tried with use ref but was not able to make it work, feel free to suggest. In your text, I would be more ...
Vismay Yerunkar's user avatar
1 vote
2 answers
633 views

Use a variable as as key of an interface to get the typeof

Is it possible to use a variable to get the typeof a key in a interface? For example: interface DbSchema { jobs: { jobId: number; jobName: string; } users: { userId: number; ...
Pieter's user avatar
  • 48
0 votes
1 answer
45 views

How do I type an object's key in an array in a type script?

I want to type the key values of the objects inside the already declared array. const temp = [ { key: "name", value: "mike" }, { key: "gender", value: "male"...
choisuhyeok's user avatar
3 votes
0 answers
2k views

node.js ERR_IMPORT_ASSERTION_TYPE_MISSING TypeError: Module tsconfig.json needs an import assertion of type "json"

{ "extends": "../../tsconfig.json", "include": [ "**/*.ts" ], "exclude": [ "node_modules", "...
khteh's user avatar
  • 3,748
0 votes
1 answer
989 views

How to query AWS DynamoDb using GSI Index and FilterExpression

My DynamoDB database table is as follows. It has primary key(ID) and sort key (receivedTime). ID(primary key) receivedTime(sort key) Data ID1 1670739188 3 ...
JaNith RathNayaka's user avatar
2 votes
1 answer
50 views

Create union of interface values based on keys of another type

I have an interface with keys as enums and further interfaces as values. enum Enum { Val1, Val2, Val3 } interface MyInterface { [Enum.Val1]: { bookingId: string } [Enum.Val2]: { videoId: string }...
nonsequiter's user avatar
1 vote
1 answer
805 views

Use keys of one type to create type containing keys of another type

I have an interface of types as such: interface MyInterface { Name1: { userId: string } Name2: { bookingId: string } } I have a type below that accepts an object of type { [key: keyof MyInterface]...
nonsequiter's user avatar
1 vote
1 answer
533 views

How to change pages using a function in React

When a user logs in and clicks the button, a function is called and this function calls a function that returns a Promise. When the user logs in, the href property is responsible for changing pages. I ...
caiosa's user avatar
  • 41
0 votes
2 answers
4k views

How to remove script tags in index.html from Angular Component

<script data-jsd-embedded data-base-url="" data-key="" type="text/javascript" src="js-text-sample.js"></script> Above is my sample script tag which ...
Anthony Cuartero's user avatar
-1 votes
2 answers
4k views

URLSearchParam type {property: value} is not assignable to undefined & Argument Type {property: value} not assignable to {property: value}

I keep getting this error when I try to execute the following code. Basically it takes in the given refresh token and send a POST request with the URLSearchParams to the URL. But for some reason ...
Ashwin's user avatar
  • 100
0 votes
2 answers
69 views

typescript infer never[] when returned empty array from catch statement with async/await method

method getData() returns Promise<Output[]> without catch statement type of data inferred is Output[] but when I try to put catch statement in front of getData() method type of data becomes ...
Kashif Ghafoor's user avatar
-1 votes
1 answer
39 views

Typescript remove property restructure array

Convert array to array below in typescript. Before: ` [ {propety: 332}, {propety: 325}, {propety: 125} ] ` After: ` [ {332, 325, 125} ] `
Sevensnake77787's user avatar
0 votes
0 answers
41 views

converting string value to enum type value [duplicate]

I have created a enum in typescript: export enum ProductType { FRUIT, CLOTH, } I wonder if I receive string value fruit and cloth, how can I convert the string to the enum type. Here is what I ...
user842225's user avatar
  • 5,899
0 votes
1 answer
321 views

typescript: validate function argument based on callback return type

I'm trying to type a function witch run a callback for each array item and extend that item with a new properties: interface Row { a: number } export function extender< Data extends Row[], ...
yurk's user avatar
  • 21
0 votes
0 answers
776 views

call my API (typescript) with my frontend application in VUE3 Js

hey i develloped an Api rest in nodejs and i 'd like now consume it but i've always the same strange error. i've never used vue before, moreover i'm using Vue3 which is recent. Hey here is my code ...
XelahZ's user avatar
  • 21
0 votes
0 answers
27 views

Starting to work on Typescript : Not able to understand why this promise.all is not working [duplicate]

I was assuming that by using await I am making sure that the promise will get completed(it will wait at this statement until the promise is complete) before moving to the execution of next line. But ...
Yash Khare's user avatar
0 votes
1 answer
515 views

Type '{ description: String; }' is missing the following properties from type 'IOrderFormWithReactProps': context, siteUrlts(2769)

i dont know why this error occurs. it shows Type '{ description: String; }' is missing the following properties from type 'IOrderFormWithReactProps': context, siteUrlts(2769) ***...
mohan vm's user avatar
1 vote
2 answers
280 views

Typescript :: Related Generic Constraints

In React, I have a generic interface like so: interface BaseProps<T> { data: T; } The consumers of my code will extend this to define their own Props and Component: interface MyProps extends ...
AweSIM's user avatar
  • 1,703
0 votes
2 answers
492 views

TS : How to create a type factory using a string to generate the keys

I am trying to create a way to easily generate a type that defines a multitude of key values association with a specific name pattern in the keys. I have a specific type that is very repetitive, as ...
Edouard Short's user avatar
1 vote
0 answers
301 views

Type 'Recommendation[]' does not satisfy the constraint 'PathParams'. Index signature for type 'string' is missing in type 'Recommendation[]'.ts(2344)

I am building a app using react, typescript and msw. When I am adding types I got this error: Type 'Recommendation[]' does not satisfy the constraint 'PathParams'. Index signature for type 'string' is ...
Jozin Zbazin's user avatar
3 votes
1 answer
138 views

Param type resolution when combining union and intersection types in TypeScript

Here are 3 simple types type T1 = | { letter: 'a'; valueFunc: (prop: number) => void; valueType: number } | { letter: 'b'; valueFunc: (prop: string) => void; valueType: string } type T2 = { ...
Lordbalmon's user avatar
  • 1,704
3 votes
1 answer
652 views

typescript upgrade 1.8.10 to 2.9.2 and 4.6.4 build error

I have an angular application, using typescript 1.8.10 and working fine. I like to try and upgrade typescript from 1.8.10 to 2.9.2. Once I change this setting in package.json and run npm install I ...
Jefferson's user avatar
  • 113
-2 votes
1 answer
2k views

convert string date to datetime format in Angular / Typescript and compare it with current date

I'm new to angular and I need some help in datetime conversion. My datetime in string is Sat, 30 Apr 2022 00:00:00 GMT but I want to compare this date (only Sat, 30 Apr 2022) with current date. How do ...
ninjacode's user avatar
  • 328
0 votes
1 answer
255 views

Typecasting when render the prop with union Types

I have a two properties in my component. prop1: CustomObject<string, type1> prop2: CustomObject<string, type2> | Array I will accept only prop1 on priority and if prop1 is not available ...
Roster's user avatar
  • 1,904
0 votes
3 answers
4k views

How to avoid logout after a refresh in Angular

I have problem with logout after I refresh the page. I think that problem is in method for getting current user or in method for checking is user admin. admin-auth-guard.service.ts export class ...
kralj99's user avatar
-1 votes
2 answers
9k views

How to dynamically set month end date if start date is picked from the calendar of Angular's mat-datepicker functionality?

Eg. If Start date picked from calendar is "15/06/2000" and if no End Date is selected from calendar then End Date gets automatically set to "30/06/2000". End Date can also be ...
Code Debug's user avatar
2 votes
3 answers
110 views

Want to write regex in javascript which will check if all the mentioned chars exist at least ones

I have string s and need to check if that string contains every single alphabet from a to z. What will the regex be to check this condition? where s can be very big string with multiple words ...
Kitty's user avatar
  • 167
2 votes
1 answer
849 views

Large file downloads don't work in Firefox browser

I have a Angular app where users can download some documents(.jpg, .mp4 and .pdf) that they uploaded. Basically the download of the file works in this way: A service is called which returns some ...
Andre's user avatar
  • 439
1 vote
0 answers
13 views

typescript Can an array type be converted to an object? [duplicate]

In the type, is it possible to convert the array type to the object type? class Ad { constructor(name: string, age: number) {} } type Ac = ConstructorParameters<typeof Ad> // Ac = [name: ...
maskletter's user avatar
0 votes
1 answer
76 views

How to disabled the button, when checkbox are not selected

I am trying disabled the button, but the Typescript code doesn't work! When I selected the first and two checkbox, but I deselected the first checkbox, the button automatically is disabled. Example ...
Jessica Alexandra Rendón Baños's user avatar
0 votes
1 answer
2k views

Why do I keep getting Not all code paths return a value here?

I'm trying to understand why I keep getting this error from typescript. PS. I know I would just use the boolean in this case and not create function, this question is more about typescript. Not all ...
jmecs's user avatar
  • 177
0 votes
1 answer
1k views

Angular Typescript Create a File object from assets img directory

I'm trying to implement a custom image selection. I want to propose several image in a modal and when a user click on one element, put it in a File object in my ts (like a file picker). I don't want ...
Damian's user avatar
  • 141

1
2 3 4 5
30