seald / nedb

The JavaScript Database, for Node.js, nw.js, electron and the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FR] Add types to make TypeScript compile

FossPrime opened this issue · comments

https://github.com/seald/nedb
sandbox: https://codesandbox.io/s/declarator-demo-ivwep

I cannot get this to run on TypeScript without completely disabling it. More strangely, all the known workarounds seem to fail for this package.

and index.d.ts should fix this.

[ERROR] 21:46:18 ⨯ Unable to compile TypeScript:
src/models/users.model.ts:3:18 - error TS7016: Could not find a declaration file for module '@seald-io/nedb'. '/sandbox/node_modules/@seald-io/nedb/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/seald-io__nedb` if it exists or add anew declaration (.d.ts) file containing `declare module '@seald-io/nedb';`

3 import NeDB from '@seald-io/nedb';

NeDB types are here https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nedb

commented

Fixed by #12