Open timotejroiko opened 1 year ago
I can update the typings, but I can't reproduce any segfault when omitting the path (in fact the unit tests extensively use databases opened without a path so that can run on temp databases). Do you have any steps to reproduce this?
Hey, thanks for the reply.
For me it happens on node 20.3.0 on windows when you explicitly set path
to a falsey value, for example { path: "" }
or { path: null }
or { path: undefined }
. It works correctly if explicitly omitted like this {}
Using lmdb v2.8.2
Hey, just to add to this: I've been using 2.9.1 and the typescript declarations seems to be different between ES and CJS files. index.d.cts
has path
as a required key in RootDatabaseOptionsWithPath
while index.d.ts
lists path
as optional. As a result ts-jest fails to compile tests that are using temporary lmdb databases (there's a bug in ts-jest where it prefers .d.cts
files over .d.ts
or .d.mts
https://github.com/kulshekhar/ts-jest/issues/4221)
Hello,
According to documentation, omitting the
path
parameter duringdb.open()
should create a temporary database that automatically deletes itself. However Typescript erroneously claims thatpath
is a required parameter and cannot be omitted.Furthermore, any attempt to make
path
behave as if omitted by setting it to null or undefined causes a segfault.Not a high priority issue, but we could improve QOL here by both updating the typings to mark
path
as optional as well as preventing null/undefined path from segfaulting and make it behave as if it were omitted.Thanks!