Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

497
Views
MongoDb no puede usar tipos en broma: declara ... localmente, pero no se exporta

Uso la biblioteca mongodb en TypeScript para algunas funciones (por ejemplo, funciones lambda, pero eso no debería importar).

Las importaciones se ven así:

 import { ObjectId, Db, InsertOneResult } from "mongodb";

Cuando importo la función en Jest y la ejecuto, siempre obtengo el error:

 Module '"../../node_modules/mongodb/mongodb.ts34"' declares 'ObjectId' locally, but it is not exported.

Creo que algo está mal con mi lógica de broma, pero no estoy seguro de qué. La función en sí está funcionando.

Mi configuración de broma se ve así:

 const tsPreset = require("ts-jest/jest-preset"); module.exports = { ...tsPreset, testEnvironment: "node", roots: ["<rootDir>/test"], testMatch: ["**/*.test.ts"], moduleNameMapper: { "^@/types/(.*)$": "<rootDir>/types/$1", "^@/lib/(.*)$": "<rootDir>/lib/$1", "^@/functions/(.*)$": "<rootDir>/functions/$1", }, };
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Esto parece estar relacionado con este boleto . Las versiones actuales del controlador de nodo mongodb ya no son compatibles con TypeScript 3.9.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!