Level / level

Universal abstract-level database for Node.js and browsers.
MIT License
1.55k stars 106 forks source link

chore: add types for `destroy` #225

Closed MicaiahReid closed 2 years ago

MicaiahReid commented 2 years ago

Fixes #224

vweevers commented 2 years ago

As noted in https://github.com/Level/level/issues/224#issuecomment-1271868543, these types are incompatible with browser-level.

That could technically be solved by just adding an overload to the types, but that would wrongly suggest both function signatures are available in node and browsers. What level promises to export, is an abstract-level implementation. Which is reflected in both its types and the documentation in the README.

We could also document destroy() here, but then level has to document the differences between classic-level and browser-level - while its intended purpose is the exact opposite. For convenience, the level README does describe some of those differences, but only for individual methods and their options. We have to draw the line somewhere, and its drawn between 1) methods that are part of abstract-level and 2) additional implementation-specific methods like destroy().

Bottom line, if you want to use a typed destroy(), then replace level with classic-level. Or import its types, but if you're already directly depending on classic-level then level serves no use.

MicaiahReid commented 2 years ago

I see, thank you for the clarification!