Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bdb: expose more db types. #26

Closed
wants to merge 1 commit into from
Closed

Conversation

nodech
Copy link
Member

@nodech nodech commented Sep 10, 2024

This allows db consumers to use Batch/Iterator/etc. to use these types as args in typedefs.

e.g.

/** @typedef {import('bdb').DB.Batch} Batch */

class AbstractMigration {
  ....
  /**
   * Run the actual migration
   * @param {Batch} batch
   * @returns {Promise}
   */

  async migrate(batch) {
    throw new Error('Abstract method.');
  }
}

@nodech
Copy link
Member Author

nodech commented Sep 10, 2024

Alternative is here: pinheadmz/bsdoc@74ab5ef

This can be used to use typescripts: ReturnType helper instead and grab Batch etc like:

/** @typedef {ReturnType<import('bdb').DB['batch']>} Batch */

@nodech nodech closed this Sep 20, 2024
@nodech nodech deleted the export-batch branch September 20, 2024 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant