Category "typescript"

Can't access state object in child component with React/TypeScript

I'm a beginner at TypeScript and I'm trying to access my state object (from App.tsx) within Questions.tsx. So I want/need to access for example chosenAmount in

Return subset of union depending on class in generic function

This is very much like my other question, but this time using classes instead of plain objects. class Error1 extends Error { constructor(message: string, pu

How can I validate a Solana wallet address with web3js?

I'm trying to validate that the input text I get from a user is a valid Solana address. According to the web3.js documentation, the method .isOnCurve() does tha

Typescript SyntaxError: Cannot use import statement outside a module (side file containing functions)

I am creating a minecraft bot using mineflayer library. After a bit of work I decided to make code readable and reusable (image of file organisation) and also s

Unexpected token in JSON at position 0 when running npm start in React Typescript project

Whenever I try to run the 'npm start' command, I get this weird error. It was working fine a few hours ago and now it simply won't start. I've tried reinstallin

Store Object with Angular Autocomplete, not only Value in Input

Working on Angular, I created an Input with mat-autocomplete and mat-option (data comes from an Object Array, using NgFor). Properties of Object are ID, name an

Vitest defineConfig, 'test' does not exist in type 'UserConfigExport'

Trying to setup vitest on an already existing vite (vue 3, typescript) project. My vite.config.ts looks like this: import { defineConfig } from 'vite'; import v

How to configure custom key for data that has composite primary key in @urql/exchange-graphcache cacheExchange

On the frontend I have a Cart, it has buttons to call a GraphQL mutation to increase or decrease the quantity of a product. The mutation worked as expected, exc

How to get a Fieldvalue only if other fieldvalues in the same document are true

How to: If I want to retrieve a FieldValue (String) only if in the same document there is another field (boolean) which is true. For Example: If I have a Docume

Hardhat Config Error HH100: Network goerli doesn't exist

I am trying to deploy a contract on Goerli, but I constantly get the error Error HH100: Network goerli doesn't exist Here is my hardhat.config.ts require("doten

Cypress: Add option to allow LocalStorage

The following facts: page 'X' Open -> cy.visit('/x'); check checkbox 'A'-> cy.checkCheckbox('A'); close browser or reopen page ?????? check if checkbox 'A

How to invoke a machine with context of the machine that invokes that machine?

Firstly, here’s the code. I need to fix. Basically, there are two machines: currentStateMachine: currently, I want to change the state manually (running s

Module not found: Error: Can't resolve 'trusted-types' in '' angular

getting Module not found: Error: Can't resolve 'trusted-types' installed trusted types using this command npm i @types/trusted-types --force. and npm install t

Elasticsearch Node.js delete does not work

I have the following function to remove document from index: async deleteDocument (indexName: string, id: string) { const indexExist = await this.isIndexExi

Property 'children' does not exist on type after assigning type React.FC to component

I have assigned type React.FC to my component but I still dont't have access to the children props. I get this error "Property 'children' does not exist on type

Accessing the AWS gateway resource in another stack in cdk stack

I have a stack where an api gateway resource is created. I have a construct under this stack from where i need to create a method to the above resource. I tried

MongoDb can't use types in jest - declares ... locally, but it is not exported

I use the mongodb library in TypeScript for a few functions (e.g. lambda functions but that should not matter). The imports look like that: import { ObjectId, D

Typescript: Why Partial Utility Type doesn't work on Indexed Access Types

When using Partial on indexed access type, it doesn't set the properties to optional: e.g. class Klass { prop = { a: true, b: 42, };

How to make existing angular application "fully strict" step by step?

I have an existing Angular Application that started development at the time of Angular 4, now it's on Angular 12. But at the time of development, the strict mod

Typing custom event with typescript

I'm asking for a suggest on how to type correctly the schema for how an EventObject should be, including what's inside the "extendedProps" key. As of now I've d