feat(types): export Projector, ArrayOperators, QueryResultType, and P…#16239
Closed
Tidjani1Bachir wants to merge 1 commit intoAutomattic:masterfrom
Closed
feat(types): export Projector, ArrayOperators, QueryResultType, and P…#16239Tidjani1Bachir wants to merge 1 commit intoAutomattic:masterfrom
Tidjani1Bachir wants to merge 1 commit intoAutomattic:masterfrom
Conversation
…luginFunction helper types
Contributor
There was a problem hiding this comment.
Pull request overview
Exports several previously-internal TypeScript helper types from mongoose so downstream library authors can import and reuse them directly (per #16235).
Changes:
- Exported
Projector,ArrayOperators,QueryResultType, andPluginFunctionfromtypes/index.d.ts. - Added a new type test file to validate the new named exports are importable and behave as expected.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| types/index.d.ts | Makes select helper types part of the public mongoose TypeScript surface area via export type. |
| test/types/exportedTypes.test.ts | Adds compile-time type assertions ensuring the newly-exported types can be imported and used. |
| @@ -0,0 +1,18 @@ | |||
| import { Projector, ArrayOperators, QueryResultType, PluginFunction, Query, Schema } from 'mongoose'; | |||
There was a problem hiding this comment.
Schema is imported but never used in this type test, and all mongoose imports here are used only in type positions. Consider removing the unused Schema import and switching the mongoose import to an import type to match other type-test files and avoid generating a runtime import if these tests are ever emitted.
Suggested change
| import { Projector, ArrayOperators, QueryResultType, PluginFunction, Query, Schema } from 'mongoose'; | |
| import type { Projector, ArrayOperators, QueryResultType, PluginFunction, Query } from 'mongoose'; |
Collaborator
|
Closing this as a duplicate of #16243 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #16235
What this PR does
Exports previously internal TypeScript helper types so library
authors can use them directly.
Changes
types/index.d.ts: addedexporttoProjector,ArrayOperators,QueryResultType, andPluginFunctiontest/types/exportedTypes.test.ts: added type tests to verifythe exports work correctly
Testing
All 39 type test files pass (958 assertions)