Skip to content

Type 'MongoClient' is missing the following properties from type 'MongoClient': logger, getLogger #493

Description

@nileshtrivedi

Running npm install and npm start on Mac M1 pro throws this type error related to MongoClient

eshnil in ~/code/textbooks on branch master > node -v
v20.3.0
eshnil in ~/code/textbooks on branch master > npm -v
9.6.7

/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:859
    return new TSError(diagnosticText, diagnosticCodes, diagnostics);
           ^
TSError: ⨯ Unable to compile TypeScript:
node_modules/@mathigon/studio/server/utilities/mongodb.ts:40:29 - error TS2322: Type 'Promise<import("/Users/eshnil/code/textbooks/node_modules/mongoose/node_modules/mongodb/mongodb").MongoClient>' is not assignable to type 'Promise<import("/Users/eshnil/code/textbooks/node_modules/mongodb/mongodb").MongoClient>'.
  Type 'MongoClient' is missing the following properties from type 'MongoClient': logger, getLogger

40   return MongoStore.create({clientPromise, touchAfter: 12 * 3600});
                               ~~~~~~~~~~~~~

  node_modules/connect-mongo/build/main/lib/MongoStore.d.ts:14:5
    14     clientPromise?: Promise<MongoClient>;
           ~~~~~~~~~~~~~
    The expected type comes from property 'clientPromise' which is declared here on type 'ConnectMongoOptions'

    at createTSError (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:859:12)
    at reportTSError (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:863:19)
    at getOutput (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:1077:36)
    at Object.compile (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:1433:41)
    at Module.m._compile (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:1617:30)
    at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/eshnil/code/textbooks/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1113:32)
    at Function.Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1137:19) {
  diagnosticCodes: [ 2322 ]
}
ERROR: "server" exited with 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions