kriszyp / lmdb-js

Simple, efficient, ultra-fast, scalable data store wrapper for LMDB
Other
505 stars 41 forks source link

TS: openDB inherits typings from root? #111

Closed Llorx closed 2 years ago

Llorx commented 2 years ago

I open a root db with let db = open<ValueType, KeyType>({...}); and then I create some more databases with db.openDB({...}). The problem is that those databases have their own types (that's why I'm creating them), but is impossible to set a type using generics as openDB() has no generics, hence inheriting the types from the root db.

I can force the typings by casting to unknown and then to the database type, but is more clean if the typings are set using generics instead.

EDIT: Just created a PR for you to review: https://github.com/DoctorEvidence/lmdb-js/pull/112