Category "typescript"

enabling lazy load for angular component

<div class="flex-container-new"> <div class="header-alert-gauges"> <div style="margin: 0px 2px 0px 26px;"> <dashbo

Object validation - How to validate [key: number]: string

I'm trying to write validator for JSON returned from Bugzilla API. When I'm fetching comments data, I'm getting something like this: curl https://bugzilla.mozil

Can I add a function with the (click) event to my span tags that I added with the replace method?

https://i.stack.imgur.com/B5doW.png I have sentences like this, and as you can see, if the word I'm looking for is in that sentence, I put it in span tags. .rep

Ng serve throwing @angular/core/core has no exported member 'ɵɵFactoryDeclaration'

I'm getting errors stating that angular/core/core has no exported member 'ɵɵFactoryDeclaration' while I ran ng serve on angular9 project. The error I

Ng serve throwing @angular/core/core has no exported member 'ɵɵFactoryDeclaration'

I'm getting errors stating that angular/core/core has no exported member 'ɵɵFactoryDeclaration' while I ran ng serve on angular9 project. The error I

Visual Studio 2022 - Lots of errors in TypeScript Angular Project

Yesterday I created a new Standalone TypeScript Angular Project in Visual Studio 2022. After a couple of minutes playing around with it, I already got a bunch o

Although I write the necessary codes, I can't get results [closed]

Laptop text and price should appear on the blue button. Although I write the necessary codes, I can't get results <div class="card" style

How to create a reusable react-hook-form component with TypeScript generics?

Person component is reused in two different forms: Person.tsx import { UseFormReturn } from "react-hook-form"; import { FieldPaths } from "./types"; type Prop

Why does Zod make all my schema fields optional?

I am using Zod inside my Express & TypeScript & Mongoose API project and when trying to validate my user input against the user schema it returns types

typescript not recognising type for the tupple returned

Below code throws an error when the tuppleFunc is used in the error field for the payload. interface FormItemPayload { value: string; error: boolean; erro

typescript not recognising type for the tupple returned

Below code throws an error when the tuppleFunc is used in the error field for the payload. interface FormItemPayload { value: string; error: boolean; erro

Why does Zod make all my schema fields optional?

I am using Zod inside my Express & TypeScript & Mongoose API project and when trying to validate my user input against the user schema it returns types

Unsafe value used in a resource URL context (iframe)

Trying to pass value as iframe url from local db and and im getting error message: Unsafe value used in a resource URL context. i'm trying to display an array

How to set initial state for redux reducer in typescript?

I am getting this TypeScript error Property 'hasError' does not exist on type '(state: ErrorType | undefined, action: ErrorActionType) => ErrorType'. which I

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