Skip to content

types: add toBSON() to documents#15927

Merged
vkarpov15 merged 1 commit into8.xfrom
vkarpov15/tobson
Dec 30, 2025
Merged

types: add toBSON() to documents#15927
vkarpov15 merged 1 commit into8.xfrom
vkarpov15/tobson

Conversation

@vkarpov15
Copy link
Collaborator

Summary

toBSON() is a public method, should be available in TypeScript too

Examples

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the toBSON() method to Mongoose document TypeScript type definitions, exposing a public method that was previously only available at runtime.

  • Adds toBSON() method signature to the Document interface
  • Includes a test case to verify the type signature

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
types/document.d.ts Adds toBSON() method returning Require_id<DocType> to Document interface
test/types/document.test.ts Adds type test case for toBSON() method to verify return type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vkarpov15 vkarpov15 merged commit 7dbda12 into 8.x Dec 30, 2025
11 checks passed
@hasezoey hasezoey deleted the vkarpov15/tobson branch December 31, 2025 11:47
@hasezoey hasezoey added the typescript Types or Types-test related issue / Pull Request label Dec 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

typescript Types or Types-test related issue / Pull Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants