classic-level
classic-level copied to clipboard
Typing of `get` is missing the `undefined` as a possible return value
The Typings is assuming that the return value of get is always of the type stored in the database. But in fact, if a key is not set, then the return value is undefined.
So instead of https://github.com/Level/classic-level/blob/15eb2893086ff52f6ce5b2b79a21ca6340b966fc/index.d.ts#L51-L52
I would suggest to adapt it to
get (key: KDefault): Promise<VDefault | undefined>
get<K = KDefault, V = VDefault> (key: K, options: GetOptions<K, V>): Promise<V | undefined>
Agreed. We did that in abstract-level but forgot to copy it to here. PR welcome.
@vweevers : Added PR #117