All Questions
Tagged with node.js typescript
16,192
questions
0
votes
0
answers
9
views
Problems publishing to a private npm registry (CodeArtifacts) using Lerna
I'm looking to move from public npm registry to private npm registry hosted in AWS.
The cmd that we are using to publish to a private registry is
lerna publish --conventional-commits --conventional-...
0
votes
0
answers
22
views
Request fails when sending from fetch but succeeds in api client
I am sending the following fetch request:
try {
const response = await fetch(`http://localhost:3000/fs`, {
headers: {
Accept: "*/*",
method: "readFile&...
1
vote
1
answer
38
views
Is the method subscribe in angular 17 is not working
export class HomeComponent implements OnInit {
data: any;
constructor(private apiService: ApiService) { }
ngOnInit(): void {
// Substitua 'your-endpoint' pelo seu endpoint real
this....
0
votes
1
answer
14
views
beforeSoftRemove hook not updating database entry using Nest.js and TypeORM
I want to implement a solution in Nest.js and TypeORM application that every record that is getting created should have createdById, updatedById and deletedById against their actions. Let me share the ...
0
votes
1
answer
18
views
Mock being ignored, jest node
I'm trying mock a database with this test but the mock seems to be ignored. I can't think of a reason this could be?
import { jest } from '@jest/globals';
jest.mock('../database', () => ({
...
0
votes
1
answer
34
views
gte and lte in prisma & mongodb
The error message "Type '{ $gte: number; $lte: number; }' is not assignable to type 'number'" indicates that you are trying to assign an object with $gte and $lte properties to a variable ...
1
vote
1
answer
44
views
Dropdown Select Component Has Data One Step Behind
I have a dropdown menu in my app. When it is selected it triggers a method that changes the sortOption state, which then triggers a useEffect to sort the data (called allTabs). However, the data ...
0
votes
1
answer
28
views
Typescript: Typing return for a "retry function" using .call
If I'm passing a typed function to Function.prototype.call, is there a way to infer the return type from the passed function?
Below I would expect response to be typed based on someTypedFunction ...
0
votes
0
answers
11
views
How to detect duplicate Job add in Bull Queue in Nest?
I am using bull queue in Nest. I know it adds only jobs with unique ids and if the job exists with an id, it doesn't add it and returns existing job. Is there any way to check whether the job I added ...
0
votes
0
answers
39
views
Create a history table and keep track of all the updates to a document
I have a NestJS application that uses mongoose and MongoDB. I need to capture all changes/versions of this document so that I can display this as a history of the document, what changes were made by ...
1
vote
0
answers
18
views
How to generate the Typescript declaration files .ts.d from a Node Native Addon (C++)
I have a C function I want to use in a Typescript NodeJS project.
The working minimal project example
I created .CPP file that wraps my C function using N-API and make it available to NodeJS. I ...
-4
votes
0
answers
41
views
Angular Nodejs Incorrect Login or Password
I'm trying to figure out the best way to handle login(incorrect username or password).
When user logs in I do my authentication on server side which works the way it is suppose to, if incorrect ...
0
votes
0
answers
27
views
Getting ORA-03106: Fatal Two-Task Communication protocol error in NodeJS calling a procedure
Currently, I'm using NodeJS/Typescript and node-oracledb (v5.5.0) to connect to an oracle database to run some queries. I'm using an oracle connection pool to get the connections. What I've been ...
0
votes
0
answers
34
views
Jest mocking core NodeJs module
I'm trying to write an abstraction layer for an Electron application that runs in a Node (v20) environment. This layer will make it so that there is only one access point to the file system for the ...
1
vote
1
answer
27
views
oracle sql server connection pool not updating the table column
I'm working in node.js with oracledb.
I have create connection pool to connection database.
When I fetch any data from database it's working perfectly.
But when I'm trying to update table column it's ...
0
votes
1
answer
43
views
TypeScript Error: Implicitly has return type 'any' for Function with Recursive Call
So I have been trying to implement an Access and Refresh Token system for a while now.
I have had some success some failures. Some frustration. But overall I feel happy with my results.
I have come up ...
0
votes
3
answers
55
views
Request with express hangs
I have the following code:
export default class Server {
private app: Express;
public port: number = 3000;
constructor() {
if (!isNode) {
throw new Error("The server must be ...
0
votes
1
answer
32
views
Mongoose Validation Error on lastUpdated Field Despite Setting It Before Save
I'm running into a bit of an issue with Mongoose in my Node.js/Express application, and I would greatly appreciate your help. The problem occurs when I try to update a Restaurant document in MongoDB. ...
0
votes
0
answers
59
views
Dynamically created Function is not calling or returning
I'm trying to dynamically create a Function in javaScript. Here is my code:
class Server {
// Omitted for brevity
public async method(method: Function, args: any[]) {
const fsp = await ...
0
votes
0
answers
12
views
PrismaAdapter can't build
My code working in "npm run dev" mode, but when I want to build my project I take this error:
./node_modules/next-auth/src/core/lib/assert.ts:134:27
Type error: Element implicitly has an '...
-3
votes
0
answers
27
views
why the import file from different path in VScode? [closed]
this is package.json config.
{
"name": "vue-test",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"dev"...
0
votes
0
answers
41
views
+50
Typescript composite project with NextJS
I have reorganized my project in NodeJS/Typescript using workspaces and project references. One of the workspaces (sub-project) is a NextJS application, and the recommended tsconfig.json includes the ...
-1
votes
2
answers
43
views
How to share data between concurrently executed promises in NodeJS
I want to share data between the two concurrent method calls shown below.
async generateSuggestedSparks(userId: GraphID, friends: Person[], latLng: LatLng) {
let suggestions = await this....
0
votes
1
answer
37
views
Why won’t TypeScript let me import a type from an ES module into a CommonJS module?
I’m writing a Node.js app in TypeScript. Here’s a simplified version of my files so far:
// package.json
{ "type": "module" }
// tsconfig.json
{
"compilerOptions": {
...
0
votes
1
answer
43
views
Type error in TypeScript 5.6: Type '() => Generator<string, void, any>' is not assignable to type '() => BuiltinIterator<string, undefined, any>'
For my unit tests I create a fake window.location object. Here's the slightly simplified code:
function getFakeLocation(getCurrentUrl: () => URL): Location {
return {
get ancestorOrigins(): ...
0
votes
0
answers
14
views
How to reuse a function in Next.js from getStaticProps and on the client to handle URL changes without reloading the page?
I'm working on a Next.js application where I need to manage dynamic content based on the URL. The function determineRegionSlug is centralized in a service file (service.ts) and is called from ...
1
vote
1
answer
44
views
openapi-generator-cli axios client, getting SyntaxError: The requested module X does not provide an export named 'PokemonApi'
I generated an Axios Typescript client for the PokeAPI using OpenAPI Generator with the following command:
npx openapi-generator-cli generate -i https://raw.githubusercontent.com/PokeAPI/pokeapi/...
0
votes
0
answers
11
views
Dynamic RAM allocation with node.js
I have a node.js application being managed by pm2, the application allocates dynamic memory by default and is limited to using as little memory as possible and using memory if necessary. However, this ...
0
votes
0
answers
18
views
"Could not find" local declaration file written for an npm package
I have a TypeScript server running within a docker container that needs to use the NPM package "opsgenie-sdk". This package does not have any TypeScript types within the package, or ...
-1
votes
0
answers
27
views
Mocha tests pass locally but fail in GitHub Actions with 400 Bad Request Instead of 201 Created
I’m encountering an issue where my Mocha tests for a Node.js application pass locally but fail in the GitHub Actions CI environment. The tests are related to creating and verifying documents via an ...
0
votes
0
answers
45
views
node:internal/modules/cjs/loader:1080 throw err
Node v18.18.2
ts-node v10.9.2 (@latest)
When typing: ts-node (-v)
I'm getting the following error.
Error: Cannot find module 'arg'
Require stack:
- /usr/share/nodejs/ts-node/dist/bin.js
at ...
0
votes
0
answers
41
views
"Cannot set property status of [object XMLHttpRequest] which has only a getter" after upgrading Angular 12 to 13
Note: I'm resubmitting a previous question (which I'm deleting) as I've learned more.
I've inherited an application and am working on migrating it to a supported version. It started from Angular 5. I'...
0
votes
0
answers
36
views
Typescript and passing parameters using super() through extended classes
My UserNotFoundException class extends from HttpException to help manage exception errors in a project.
The original HttpException class constructor expects the status number and message string.
class ...
0
votes
0
answers
26
views
How to properly type a mock.fn() in node test runner using TypeScript?
I am using node:test with TypeScript and I want to mock a function in my unit test.
// file.ts
type ArgFnType = (arg1: CustomType1, arg2: CustomType2) => Promise<CustomType3>
export function ...
0
votes
1
answer
24
views
Modify source data rxjs
I have observable and I want to modify source (of({lastId, lastCreatedAt}) part) after each iteration of iterateAsync, but return data from listRequest, is it possible?
export const fromListIterator = ...
0
votes
1
answer
33
views
MongoDB URI Undefined in GitHub Actions CI/CD Pipeline Despite Working Locally
I’m having trouble with my GitHub Actions CI/CD pipeline when it comes to connecting to MongoDB. The connection works perfectly in my local environment, but when I run the tests in GitHub Actions, I ...
0
votes
0
answers
16
views
Medusa Subscriber Not Logging Product Updates
I'm having trouble with a Medusa subscriber that's supposed to log product update events. The subscriber is being triggered, but the log message is not appearing.
import {
ProductService,
...
-1
votes
1
answer
34
views
Can we have Multiple Interceptor for a single Http method in Nestjs?
Is it possible to have multiple interceptor for a single HTTP method.
for instance we a have a file upload method, where the express fileInterceptor handles.
And I have generalized response structure ...
0
votes
0
answers
24
views
Setting Cookie is working in postman but not in chrome vercel production
I am trying to create a login function for my movies website and im using passportjs for authentication, the cookie is working in postman but when i integrate it to the login function of my front end ...
-3
votes
0
answers
40
views
ts-node isn't working for a simple typescript application [duplicate]
I've reviewed all the other answers on stack overflow and none of them answered my question. including the one mentioned that "solves" my problem.
I'm new to the NodeJS world.
I wanted to ...
0
votes
1
answer
22
views
How can I create node package that targets multiple operating system?
I have a typescript project that uses yarn to manage building and releasing. I have an odd use-case where one dependency is "windows only". I see three places this is important: source, ...
0
votes
0
answers
38
views
Update a document in MongoDB with a regular expression
In a Typescript source code on Nodejs using MongoClient, I need to search for a field ("provider", declared as a string) with a regular expression and then update that field:
await ...
0
votes
0
answers
22
views
Exception when using agracio/edge-js in vscode-extension
Created an ts-extension with "yo code".
Then I included edge-js and added some dummy usage to ensure that it got not optimized.
// The module 'vscode' contains the VS Code extensibility API
/...
1
vote
2
answers
69
views
How to resolve The _AppComponent component is not marked as standalone, but Angular expects to have a standalone component here error?
I'm in the process of migrating my project from Angular 9.1 to Angular 18.1, but I'm encountering the following error during compilation:
NG0907: The _AppComponent component is not marked as ...
0
votes
1
answer
24
views
Initialization subdocuments models with Typegoose
We're migrating our project from pure Mongoose to Typegoose, overall we're happy but there's one issue that always bothering us.
Let's say we have a simple model:
class Animal {
@prop()
public ...
0
votes
1
answer
23
views
Error: Cannot find module 'rxjs/operators' while running npm installed package
I have written a typescript tool and published the package to an artifactory. When I install the package like npm install -g @org/[email protected]
The package is installed successfully but when I try to ...
0
votes
0
answers
67
views
Should TypeScript downcompile named import attributes?
TypeScript 5.3 introduced support for import attributes. When building an ESM project, the compiler allows using named imports, but I don't know any javascript runtimes that support this. Should ...
1
vote
1
answer
27
views
How to resolve Cannot find name 'NgxMatDatetimePickerModule'. Did you mean 'MatDatepickerModule'?
I am migrating my project to Angular 18.1 from Angular 9.1 but I'm facing the Cannot find name 'NgxMatDatetimePickerModule'. Did you mean 'MatDatepickerModule'?ts(2552) error in AppModule
I think the ...
0
votes
0
answers
9
views
NestJS: transform prop marked as 'toPlainOnly' is processed even when transforming to instance
I have an entity that masks the values when sending them to the client:
@Entity('tada')
export class DaEntity extends AbstractCustomerRelationEntity {
@Column({ type: 'jsonb' })
@IsNotEmptyObject(...
0
votes
0
answers
32
views
Request body types are not optional
In a Node.js Express TypeScript project I have such route controller:
import type { Request } from 'express';
export type TGetItemsControllerRequest = Request<
unknown,
unknown,
{
page: ...