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

fix: export mongodb types more robustly #12948

Merged
merged 1 commit into from Feb 27, 2023
Merged

fix: export mongodb types more robustly #12948

merged 1 commit into from Feb 27, 2023

Conversation

simon-abbott
Copy link
Contributor

@simon-abbott simon-abbott commented Jan 25, 2023

Summary

Mongoose exposes its underlying mongodb import via the mongo export. However, if you use import * as mongoose from 'mongoose' syntax then mongoose.mongo.X becomes untyped. By using an alias export instead, the types are preserved, even when importing like that.

Examples

See the test I added.

@AbdelrahmanHafez
Copy link
Collaborator

This looks like a good alternative to #11954
What do you think? @vkarpov15 @hasezoey

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

Nice, thanks 👍

@vkarpov15 vkarpov15 added this to the 7.0.0-rc1 milestone Feb 27, 2023
@vkarpov15 vkarpov15 merged commit 28fd1b6 into Automattic:master Feb 27, 2023
@simon-abbott simon-abbott deleted the patch branch February 27, 2023 21:58
@vkarpov15 vkarpov15 mentioned this pull request Apr 6, 2023
2 tasks
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.

None yet

4 participants