typicode / lowdb

Simple and fast JSON database
MIT License
21.35k stars 918 forks source link

Doesn't play nice with lodash + typescript (chaining) #513

Closed shennan closed 2 years ago

shennan commented 2 years ago

As per this issue in lodash typings, using chain is not a good experience with lowdb + lodash.

const db = new Low<Shape>(new Memory<Shape>())

const lodashDb = lodash.chain<Shape>(db.data)

lodashDb.get('something') // Error: Property 'get' does not exist on type 'PrimitiveChain<Shape>'

I understand this may be considered a lodash issue but given that this library used to rely on it and still promotes its use in its README, is there any way around this?

luluhoc commented 2 years ago

yeah for sure I have updated to the new version and 1.0.0 was better than this

typicode commented 2 years ago

I've updated the lodash example in the README with some TypeScript code.