Category "typescript"

Type discrimination based on *any* element of an array (not *all* elements)

I would like to create a union type in TypeScript that can use an array as a discriminant, but have a specific type match if any element of the array meets some

TypeScript static classes

I wanted to move to TypeScript from traditional JS because I like the C#-like syntax. My problem is that I can't find out how to declare static classes in TypeS

Is there a less verbose way to write DynamoDB update params?

I am new to Dynamo and I created a simple todo API with Serverless Framework and TypeScript To update an Item I have to do this huge params const const params =

Detect and warn users about caps lock is on

How to implement to detecting and warning users when caps lock is on with (or not) tooltip style in typescript (angular 4.2.2)?? Maybe with some keyup events, o

Angular Material Menu module: Export of name 'matMenu' not found

I have a little issue with Angular Material Menu module. I have this code in my app.module.ts: import { SharedModule } from './shared/shared.module'; @NgModu

Why my enum type wont work in Next.js project

I getting this error "Type 'string' is not assignable to type '"left" | "right"'." Project running on Next.js Here is my type definiton export interface TwoColu

Looping through Angular QueryList

So I want to get all the images in my component in an array, so I am using Angular's @ViewChildren which returns a QueryList of ElementRef: @ViewChildren('img

React-typescript: Object is of type 'unknown'. TS2571

I am using React-TypeScript for my project. For state management, I am using React-redux, for function handling I am using redux-saga. For gluing the redux stor

Passing array and got: ERROR Error: NG0900: Error trying to diff '[object Object]'. Only arrays and iterables are allowed

I'm developing the front-end of a crud application on angular, and i got this error when passing an array: ERROR Error: NG0900: Error trying to diff '[object O

How should Vue filters be bound using typescript?

How should Vue filters be bound using TypeScript? It is fairly straightforward with pure js, but I'm running into issue converting it to TypeScript. The code an

Javascript file upload e.target == null when choosing another file after initially chose one

I've currently implemented the file uploading using <input> and for some reason when I try to change the file after already chosen the file. The website w

Use Enum as restricted key type in Typescript

The question is can enum be used as a key type instead of only "number" or "string" ? Currently it seems like the only possible declaration is x:{[key:number]:a

Reconnecting a websocket in Angular and rxjs?

I have a ngrx/store (v2.2.2) and rxjs (v5.1.0) based application that listens to a web socket for incoming data using an observable. When I start the applicati

Cannot approach Typescript enum within HTML

I made an enum with Typescript to use in MyService.service.ts MyComponent.component.ts and MyComponent.component.html. export enum ConnectionResult { Succ

Add functions to an Enum

Is it possible to add functions to an Enum type in TypeScript? for example: enum Mode { landscape, portrait, // the dream... toString() { co

How to loop though Record<K, T>

I have Records type of Record: export interface List { name: string; title: string; } export type RecordType = 'recordOne' | 'recordTwo' | 'recordThree';

useLazyQuery not being called after onClick

I'm trying to check if my user isLoggedIn with a query from GraphQL API data from the user if it's loggedin if not it's supposed to return undefined or some err

Copy plugin for esbuild "is not a function"

I'm working on an esbuild configuration and want to copy a file (manifest.json) to a specific folder when I build my project for testing purposes. I included th

Unable to generate Cucumber HTML reports on failure

I have created a project framework using Typescript and Cucumber BDD approach. The executions within the project are working and the cucumber html reports are a

Angular: Swiper carousel is not working - Error: node_modules/swiper/angular/angular/src/swiper-events.d.ts

I am trying to create a carousel in angular using swiper (https://swiperjs.com/angular). I get this error: Error: node_modules/swiper/angular/angular/src/swiper