nedb: Typescript Error: 'typeof import ("xxxxxxxxxxxx/node_modules/@seald-io/nedb/index") has no construct signatures'

Describe the bug It seems that typescript it’s unable to find the constructor ( or constructor declaration) for the Datastore

To Reproduce Gist

Expected behavior To be able to Transpile it

Actual behavior Doesn’t transpile cleanly

Logs

src/db.ts:17:28 - error TS2351: This expression is not constructable.
 Type 'typeof import("xxxxxxxxxxxxx/node_modules/@seald-io/nedb/index")' has no construct signatures.

    this.aColl[coll] = new Datastore({ filename: dbfile, autoload: true });
                              ~~~~~~~~~

Found 1 error in src/db.ts:17

Environment info

  • Typescript
  • Version 5.0.3
  • Windows 7 ULtimeate 6.1 build 7601

Additional context Maybe has something to do with de fact that index.js just reexports /lib/datastore … only an idea , I’m not consider myself an expert

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 2
  • Comments: 18

Most upvoted comments

hackey workaround in the meantime, assuming esModuleInterop is true

import { default as Nedb } from "@seald-io/nedb";
const { default: Store } = Nedb;

const myDB = new Store({...});