Skip to content

Can't access custom props of QueryFilter objects #15854

@simon-abbott

Description

@simon-abbott

Prerequisites

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

Mongoose version

9.0.0

Node.js version

24.11.1

MongoDB server version

N/A

Typescript version (if applicable)

5.9.3

Description

Trying to access properties of a QueryFilter in TypeScript fails with "Property '<name>" does not exist".

Steps to Reproduce

const filter = { foo: 'hi' } as mongoose.QueryFilter<{ foo: string }>;
filter.foo; // error: Property 'foo' does not exist on type '_QueryFilter<{ foo: string; }>'.

Expected Behavior

In v8, the above code worked without producing an error. I would expect it to still do so.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions