Skip to content

.populate() clobbers the return type with { [x: string]: NativeDate; } #14825

Closed

Description

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

8.5.3

Node.js version

22.5.1

MongoDB server version

5.0

Typescript version (if applicable)

4.9.5

Description

The Typescript type for populate's return value:

const result = await SomeModel.findOne().populate<{ otherInfo: string }>("other");

includes MergeType<{ [x: string]: NativeDate; } & ....

This causes later code to assume every property is of type NativeDate.

This was observed after upgrading from mongoose 6.12.0 to 8.5.3.

Steps to Reproduce

  1. Create any model.
  2. Call findOne, followed by populate with a type parameter.

Expected Behavior

The types to be properly merged without { [x: string]: NativeDate; } being included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions