Skip to content

Commit 9cf3313

Browse files
committed
Fix types
1 parent 3eb2c9a commit 9cf3313

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

index.d.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
AbstractOpenOptions,
55
AbstractGetOptions,
66
AbstractGetManyOptions,
7+
AbstractHasOptions,
8+
AbstractHasManyOptions,
79
AbstractPutOptions,
810
AbstractDelOptions,
911
AbstractBatchOperation,
@@ -16,6 +18,7 @@ import {
1618
AbstractKeyIteratorOptions,
1719
AbstractValueIterator,
1820
AbstractValueIteratorOptions,
21+
AbstractSnapshot,
1922
Transcoder
2023
} from 'abstract-level'
2124

@@ -54,6 +57,12 @@ declare class ClassicLevel<KDefault = string, VDefault = string>
5457
getMany (keys: KDefault[]): Promise<(VDefault | undefined)[]>
5558
getMany<K = KDefault, V = VDefault> (keys: K[], options: GetManyOptions<K, V>): Promise<(V | undefined)[]>
5659

60+
has (key: KDefault): Promise<boolean>
61+
has<K = KDefault> (key: K, options: HasOptions<K>): Promise<boolean>
62+
63+
hasMany (keys: KDefault[]): Promise<boolean[]>
64+
hasMany<K = KDefault> (keys: K[], options: HasManyOptions<K>): Promise<boolean[]>
65+
5766
put (key: KDefault, value: VDefault): Promise<void>
5867
put<K = KDefault, V = VDefault> (key: K, value: V, options: PutOptions<K, V>): Promise<void>
5968

@@ -73,6 +82,8 @@ declare class ClassicLevel<KDefault = string, VDefault = string>
7382
values (): ValueIterator<typeof this, KDefault, VDefault>
7483
values<K = KDefault, V = VDefault> (options: ValueIteratorOptions<K, V>): ValueIterator<typeof this, K, V>
7584

85+
snapshot (options?: any | undefined): Snapshot
86+
7687
/**
7788
* Get the approximate number of bytes of file system space used by the range
7889
* `[start..end)`.
@@ -198,15 +209,15 @@ export interface OpenOptions extends AbstractOpenOptions {
198209
/**
199210
* Allows multi-threaded access to a single DB instance for sharing a DB
200211
* across multiple worker threads within the same process.
201-
*
212+
*
202213
* @defaultValue `false`
203214
*/
204215
multithreading?: boolean | undefined
205216
}
206217

207218
/**
208-
* Additional options for the {@link ClassicLevel.get} and {@link ClassicLevel.getMany}
209-
* methods.
219+
* Additional options for the {@link ClassicLevel.get}, {@link ClassicLevel.getMany},
220+
* {@link ClassicLevel.has} and {@link ClassicLevel.hasMany} methods.
210221
*/
211222
declare interface ReadOptions {
212223
/**
@@ -229,6 +240,16 @@ export interface GetOptions<K, V> extends AbstractGetOptions<K, V>, ReadOptions
229240
*/
230241
export interface GetManyOptions<K, V> extends AbstractGetManyOptions<K, V>, ReadOptions {}
231242

243+
/**
244+
* Options for the {@link ClassicLevel.has} method.
245+
*/
246+
export interface HasOptions<K> extends AbstractHasOptions<K>, ReadOptions {}
247+
248+
/**
249+
* Options for the {@link ClassicLevel.hasMany} method.
250+
*/
251+
export interface HasManyOptions<K> extends AbstractHasManyOptions<K>, ReadOptions {}
252+
232253
/**
233254
* Additional options for the {@link ClassicLevel.iterator}, {@link ClassicLevel.keys}
234255
* and {@link ClassicLevel.values} methods.
@@ -315,3 +336,5 @@ export type ValueIterator<TDatabase, K, V> = AbstractValueIterator<TDatabase, K,
315336
export type IteratorOptions<K, V> = AbstractIteratorOptions<K, V> & AdditionalIteratorOptions
316337
export type KeyIteratorOptions<K> = AbstractKeyIteratorOptions<K> & AdditionalIteratorOptions
317338
export type ValueIteratorOptions<K, V> = AbstractValueIteratorOptions<K, V> & AdditionalIteratorOptions
339+
340+
export type Snapshot = AbstractSnapshot

0 commit comments

Comments
 (0)