Category "typescript"

Why use triple-equal (===) in TypeScript?

In JavaScript, it's commonly seen as best practice to use === instead of ==, for obvious and well-known reasons. In TypeScript, which is one to be preferred? I

work with d.ts with a different folder for js (pdfjs-dist)

Currently pdfjs-dist https://github.com/mozilla/pdfjs-dist/tree/bd2a6cd87f9e0c3a9b3197d5d27acfb99886629b contains the d.ts and js files in separate folders: htt

Testcafe request with cookies

I am trying to find a method in testcafes API similar to Cypress' request. Cypress' request will attach any cookies to the request that already exist in the b

Typescript Node MODULE_NOT_FOUND

When I run yarn start (ts-node src/index.ts), I get MODULE_NOT_FOUND Error: Cannot find module 'src/isAuth'. It use to work before I added that new file isAuth.

Share types between client and server

I'm working on a project with a Node.js, Express.js & TypeScript backend (REST API) and a React, Redux & TypeScript frontend. In the backend I have crea

In typescript, why do the | and & operators flip their meaning when used on function types?

In this code, example1 and example2 are confusing me: type F1 = (a: string, b:string) => void; type F2 = (a: number, b:number) => void; // re: example

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