Category "typescript"

CORS problem,using axios,how can this be possible?

I'm using gin to be my backend,and this is my cors middleware code. func Cors() gin.HandlerFunc { return func(ctx *gin.Context) { method := ctx.Requ

TypeORM - how to reuse entities across many projects?

I've had a few project which is using this same database and entities. How to reuse entities across all of this projects? I don't want to copy all *.entity.ts f

Property has no initializer and is not definitely assigned in the constructor (when declaring new variables in typescript)

export class Patient { icNumber: string; fullname: string; password: string; birthday: Date; gender: string; address: string; email: string; ph

node + ts-jest + ESM, jest.mock doing nothing

I am using ts-jest with ESM imports on nodejs. The problem is that my jest.mock is not working, it is not mocking. import { jest } from "@jest/globals"; jest.m

Gulp not making bundle files

I am unable to get my bundle files created, this was working fine before I tried to upgrade to gulp4 and now that I am back on gulp3. I am not seeing the files

Lodash-es with Typescript and Webpack module error

I want to use lodash-es to be able to import only the functions I need, but I get an error. import { camelCase } from "lodash-es"; //... console.log(camelCase('

React Image Rendering using require()

I'm trying to render images in react using require(). Below is a snapshot of the code that is working. const ProjectBlock: React.FC<{ data: PROJECTBLOCK }>

How to Unit Test a method inside a module in NestJs (Jest)

I'm adding tests on a project and improving coverage. I would like to know how can I test a method defined inside a module definition in NestJs. import { Middle

Unique Set of an ordered key value pairs where the keys are only valid keys of another type

I'd like to create a type that takes a set (an array of key/value pairs with non-repeating keys). // I have any given interface: interface PersonRecord { id:

Using CDK, SNS topic Policy Statement, use actions: ["sns:*"], Cloudformation results in "Policy statement action out of service scope!"

Unable to refer to all SNS actions with the * in CDK. const MyTopicPolicy = new sns.TopicPolicy(this, 'MyTopicSNSPolicy', { topics: [MyTopic],

React MUI - Masonry mobile responsive

I'm new to react I'm trying to figure out how I can make a Masonry image grid - mobile resonsive. The idea is that I want the images to stack on top of each oth

How to listen for messages from SQS in nodesJS?

I am trying to use SQS the same way we used RabbitMQ or Kafka where we set up a listener. But I dont see a way to setup a listener for SQS anywhere in their doc

Can I mock one function exported from a typescript module that uses ES6 import style

I have been struggling with some specific ES6 importing-style and using with Jest mocking in typescript. It's very specific, so I wrote this example puzzle to

TS2304 TypeScript (TS) Cannot find name

I am getting this error about Cannot find name 'Record' is that a package I need to install for this class? Severity Code Description File Project Line

How do I wait for users to click on certain buttons in component, then return a value from that in a function depending on which button was pressed?

I have an overlay component that appears when a user clicks on certain things in my page, and in this overlay it gives a warning and 2 buttons, one for yes and

React i18n - "t" function doesn't accept string variables (typescript)? "No overload matches this call"

anyone familiar with this error: [code with error message][1] [1]: https://i.stack.imgur.com/SbJvu.png {t(`${settingType}` as const)} error: No overload matche

Inconvenience when working `as const` arrays - readonly T[] not assignable to T[] - how to remove readonly modifier from array [duplicate]

I keep running into this problem all the time (playground link): const arr = [1,2,3] as const const doSomethingWithNumbers = <T extends nu

force folder structure and names in a repository using eslint

I'm looking to force a structure of names in a specific path for a folder and it's sub folders not only the styling of the names (kebab, camel) but the actual n

NestJs e2e returns 201 created response though required form data is missing, expected 400 bad request

I'm trying to write a test that checks if request body does not have proper data, it should return an error, and the status code should be 400. Which I think is

How to generate safe RSA keys deterministically using a seed?

How do we use a mnemonic list of words as a seed (like we have been become accustomed using cryptocurrency wallets) to be able to recover a private key in case