Category "typescript"

Cannot invoke an object which is possibly 'undefined'.ts(2722)

I have a button component. I simply pass it just one onClick prop out of many optional props I've defined: const Button = (props: ButtonProps) => { const

Typescript configure mapping for compiled import path

I have an aws amplify project which is using yarn workspaces. My project has a lambda function and a layer. When the lambda function runs in aws it needs to imp

how can i give type in getServerSideProps of Nextjs with typescript?

I'm using NextJs + TypeScript to make a little clone project, but I got a problem with type in getServerSideProps. As you can see, in getServerSideProps, I am f

How to check 2 conditions in angular ngif

I am little stuck trying to get this *ngIf to work correctly. What I am trying to do is show the div if it is empty only if the user viewing is owner. If the us

Props typing in Vue.js 3 with TypeScript

I'm trying to type hint my props in a Vue 3 component, with composition API. So, I'm doing this: <script lang="ts"> import FlashInterface from '@/interfac

RTK Query: Specifying error type per endpoint

Is there a way to specify error response per endpoint? Like we can specify Result & Request type when defining a query or mutation. I did went through the d

How to return a promise with alertcontroller in ionic 4?

I am trying to convert this ionic 3 code into ionic 4 but I don't know how the promise works on ionic 4. I tried looking into the documentations and I can't fin

How to restart a local hardhat node to initial state?

I am not really sure how to restart the state of the node to the initial state. Each time I try to redeploy a contract - I'm getting the same contract, the cons

Angular 10 - cannot force error using HttpClient delete()

so I'm following an Angular tutorial right now and in the error-handling-chapter I'm currently stuck because I cannot force an error to appear when feeding a Ht

Typescript: how to inference class type that implements an interface

Giving an interface interface IAnInterface { } How to reference and point to a class type that implements that interface! Meaning! Giving a class: class AClas

Cannot find memory leak in my Express.js Jest tests

I've now spent some time trying to find memory leaks in my Jest tests, and even though I've successfully tackled some, there's still quite a lot of memory being

can't resolve module inside subdirectory typescript

The module arrayGenerator.ts lies inside a subfolder, it works fine for other modules(Array.ts) inside the parent folder. But when I add a new module Sorting.ts

How to get Auth0 User object in getServerSideProps?

I am trying to use Auth0 with NextJS for user authentication. After login I want to access the user object in getServerSideProps. I followed this link below, St

How do i add typescript support to CDN version of vue?

I'm using the cdn version of vue on certain parts of my project. I want typescript support included on these parts of the project that are using vue cdn, but du

TypeORM Insert Cascade no effect

I Have a parent entity CostCenter that contains an Array of Coordinators, coordinators: Array<Coordinator> and this attribute has the typeORM annotations

Type 'Dispatch<SetStateAction<any[]>>' is not assignable to type '(values?: string) => void'

I'm very new to typescipt and trying to make a basic pin-input page. Sandbox link for my code . Although it is working, I'm getting this error for onChange func

How to test NestJs response interceptor

I tried to follow this thread but it I keep getting an error. transform-response.interceptor.ts: import { Injectable, NestInterceptor, ExecutionContext, CallHan

JSDoc equivalent to Typescript's `as const`?

I'm in an old project that is too huge to easily convert to Typescript, so I've been using JSDoc instead. The Typescript feature that I can't figure out how to

How to test CSS properties defined inside a class with react testing library

I am trying to test CSS properties that i have defined inside a class in css, wing the react testing library. However I am unable to do so. Adding the simplifie

Sending messages on Discord Bot start / on schedule using TypeScript

I've been building a Discord Bot in TypeScript for myself and a group of friends to use. I'm trying to send a message on client ready that's completely independ