Skip to content

Commit

Permalink
Fix TypeScript declaration of chained batch write() options
Browse files Browse the repository at this point in the history
  • Loading branch information
vweevers committed Mar 6, 2022
1 parent 4bdeea9 commit 392b7f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export {
export {
AbstractChainedBatch,
AbstractChainedBatchPutOptions,
AbstractChainedBatchDelOptions
AbstractChainedBatchDelOptions,
AbstractChainedBatchWriteOptions
} from './types/abstract-chained-batch'

export {
Expand Down
12 changes: 10 additions & 2 deletions types/abstract-chained-batch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export class AbstractChainedBatch<TDatabase, KDefault, VDefault> {
* commits.
*/
write (): Promise<void>
write (options: {}): Promise<void>
write (options: AbstractChainedBatchWriteOptions): Promise<void>
write (callback: NodeCallback<void>): void
write (options: {}, callback: NodeCallback<void>): void
write (options: AbstractChainedBatchWriteOptions, callback: NodeCallback<void>): void

/**
* Free up underlying resources. This should be done even if the chained batch has
Expand Down Expand Up @@ -113,3 +113,11 @@ export interface AbstractChainedBatchDelOptions<TDatabase, K> {
*/
sublevel?: AbstractSublevel<TDatabase, any, any, any> | undefined
}

/**
* Options for the {@link AbstractChainedBatch.write} method.
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface AbstractChainedBatchWriteOptions {
// There are no abstract options but implementations may add theirs.
}

0 comments on commit 392b7f7

Please sign in to comment.