Category "typescript"

Avoid re-build of AWS Lambda Layer in CDK

I have a CDK stack that, among other infrastructure elements, deploys an AWS Lambda Layer (or actually a lambda.LayerVersion). I noticed that every time I updat

Angular - Access to object attribute with a string variable in property binding

I would like to use a string "attribute" as a key to access the value of a field in the "anim.animals" object. "anim" is an object of type Response that contain

Visiting a Url in cypress

I have a deployed application. when i open the url the website opens just fine. when i try to test it using cypress i become cy.visit() failed trying to load:

TypeError: Cannot read properties of undefined (reading 'NaN')

[enter image description here][1] I am not sure how to make this code work, cannot read properties of undefined (reading 'Nan') Here I'll attach a screenshot o

Typescript: deep keyof of a nested object

So I would like to find a way to have all the keys of a nested object. I have a generic type that take a type in parameter. My goal is to get all the keys of

Sequelize filter the included tables by where

I am trying to findAll records included nested tables, but did not understand how could I filter included tables by where clause. Here are the words: const play

Type for useRef when used with setInterval/clearInterval [react-typescript]

I am setting up a useRef object to hold a NodeJS.Timeout component, the return type of setInterval(). When I use that later in clearInterval, I get an error (sh

How to mock only one typescript class from a module, but leave other classes/functions as is, using the jest framework

I have a typescript module with a function that I'm trying to test with jest. The function I'm trying to test uses a typescript class that's defined in the same

How to write typescript with constructor function/new keyword?

This is an example from MDN docs for the usage of new keyword function Car(make, model, year) { this.make = make; this.model = model; this.year = year; }

Import a JavaScript module or library into TypeScript

Over many years I've struggled with this same issue. I cannot seem to work out how to use a JavaScript library from TypeScript, reliably. I seem to get it worki

TypeScript errors for ReactNode after migration to Create React App v5

After migrating to Create React App version 5, I have errors like the one below: TS2786: 'OutsideClickHandler' cannot be used as a JSX component. Its instance

Typescript: Type 'Promise<void>' is not assignable to type 'void | Destructor'

The editor is showing Type 'Promise' is not assignable to type 'void | Destructor'. for the checkUserLoggedIn() call in useEffect. I can get rid of it by doin

How to make scripts just run one time when app start?

I try to use facebook API for chat plugin.but it just work when i put the script in component like this FacebookPlugin.tsx import Script from "next/script"; imp

TypeScript Disallow Unecessary optional chain expression

Is there an es lint rule or typescript config to disallow the following ? let s: string; s = 'a'; s?.toLocaleLowerCase(); In my opinion, s is not nullable so n

Type is not assignable to type 'IntrinsicAttributes & MoralisProviderProps'

I am new to typescript and I really want my initialize on mount to be set to true, Does anyone know why it will only let me set it to false? Here is the error:

Angular federated module can not be loaded when route would be activated

I am trying to achieve a very simple module federation with shell (host) and travel (remote). Whenever I try do dynamically load the AbcModule from travel I get

In angular Typescript, when logging a structure it looks correct, but when logging a member in it, it gets undefined

I have the following "prod" structure (from log): cat_id: "1" category: "2" description: "The Nike Zoom Pegasus Turbo 2 is updated with a feather-light upper, w

How to use TypeScript and forwardRef in ReactJS?

I'm having a problem when using forwardRef with TypeScript. What I want? pass a typed ref to the child component. What am I getting value of console.log - child

Save Proto Timestamp as a string instead of object in Typescript

I currently have a birthday field in my proto definition defined as google.protobuf.Timestamp birthday = 1; When data is saved in the database its saved as an

Invalid document reference. Document references must have an even number of segments, but cities/SF/landmarks has 3

Hello I am following the firestore tutorial here https://firebase.google.com/docs/firestore/query-data/queries#web-version-9_14 First they instruct me to seed t