Category "typescript"

TypeScript : avoid extra properties

To make it simple, I have an issue with Typescript's "Excess Property Checks" behavior. I would like to be sure that an object with extra properties is not be a

Jest not implemented for window.open

Jest not implemented for window.open, getting error on the console but unit test is getting pass with console error a.ts file myFun(){ window.open('https://

Jest not implemented for window.open

Jest not implemented for window.open, getting error on the console but unit test is getting pass with console error a.ts file myFun(){ window.open('https://

Infer return type of function that takes a discriminated union?

I have a function that takes in an object that uses a discriminated union that returns a different structure based on that property. While i could write an asse

How to add a value within specific key when extending an interface?

Let's say I have an interface: interface Person { age: number name: { first: string second: string } } And I want to extend Person to Friend, whi

Uncaught TypeError: emit is not a function in vue3

when I write this code in vue 3 setup code block to get the input value follow this answer, this is part of the code: import { defineComponent } from "vue"; imp

Jest test for a copy to clipboard method using react with typescript

I am trying to ensure that the right value is copied to the users clipboard when they click a button. This is my copy method. I am using a ref on the input to a

webpack enhanced-resolve plugin not working

I'm trying to follow these instructions by the developers themesevles at https://github.com/webpack/webpack/issues/6817#issuecomment-542448438 which doesn't wor

"No overload matches this call" error when setting up ContextApi & useReducer using Typescript

I trying to set up ContextApi & useReducer with typescript. On my "issuesInitialState" variable in useReducer, I get the error: No overload matches this ca

How to type properties in merging object for getInitialState of createEntityAdapter object?

I want to type status with FetchingStatus type. How to implement that? type FetchingStatus = 'idle' | 'loading' | 'succeeded' | 'failed'; const initialState =

How to get React Testing Library's userEvent to type into an input

I can successfully implement a test with React Testing Library's fireEvent method, but when I try equivalent tests with userEvent I can't get it to trigger anyt

Typescript ClassDecorator target type

I'm writing my own decorators in typescript. Currently, my decorators look like this: const Controller = (prefix = ''): ClassDecorator => (target: any): voi

How to copy the inferred type of an untyped function (TypeScript) in Visual Studio Code when its very long

(See Screenshot) I have this function with a really long untyped object returned, I want to copy the inferred type of that object because it's way too long to

Add Custom No Data To Display for ngx-datatable

How can i add a custom no data to display for ngx-datatable. I don't want the no data to display that comes with ngx-datatable. What i tried is below <div *n

Typescript Generic Map type not able to set KVP [duplicate]

I am trying to create a generic Map in typescript but no KVPs are getting set in the map. class type1 { public prop1: string; } var t1: t

Typescript/cypress-cucumber-preprocessor : Writing a Scenario Outline with dynamic examples

My question is very similar to this one: Behave: Writing a Scenario Outline with dynamic examples. The difference is that I do not use Python. I handle my Gherk

Focus a specific mat-option item when mat-select dialog is opened?

I want to focus to an option(scroll to an option) automatically when mat-select is opened. I thought that with a little bit of search this will be solved easily

Angular. Consuming service from module

I have a project with ConfigService which reads values from config.json Also I use AuthModule from Nebular which configures in module (core.module.ts in my case

How to use this.$refs in vue ts that error Vue | Element | Vue[] | Element[]

I need to use this.$refs.calendars.$refs.calendar.showPageRange() in js it work but in ts that error '$refs' does not exist on type 'Vue | Element | Vue[] | El

Rollup not emitting build in docker-compose

I'm building a react app and I'm trying to have it run though a docker-compose recipe. I have it working with docker container run -p 3000:3000 --name node --rm