Skip to content

feat(types): export Projector, ArrayOperators, QueryResultType, and P…#16239

Closed
Tidjani1Bachir wants to merge 1 commit intoAutomattic:masterfrom
Tidjani1Bachir:fix/export-helper-types
Closed

feat(types): export Projector, ArrayOperators, QueryResultType, and P…#16239
Tidjani1Bachir wants to merge 1 commit intoAutomattic:masterfrom
Tidjani1Bachir:fix/export-helper-types

Conversation

@Tidjani1Bachir
Copy link
Copy Markdown

Fixes #16235

What this PR does

Exports previously internal TypeScript helper types so library
authors can use them directly.

Changes

  • types/index.d.ts: added export to Projector,
    ArrayOperators, QueryResultType, and PluginFunction
  • test/types/exportedTypes.test.ts: added type tests to verify
    the exports work correctly

Testing

All 39 type test files pass (958 assertions)

Copy link
Copy Markdown
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

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, and PluginFunction from types/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';
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

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

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';

Copilot uses AI. Check for mistakes.
@vkarpov15
Copy link
Copy Markdown
Collaborator

Closing this as a duplicate of #16243

@vkarpov15 vkarpov15 closed this Apr 28, 2026
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.

export more helper types

3 participants