Skip to content

Invalid type for Buffer #14902

Closed
Closed
@giqnt

Description

@giqnt

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.6.3

Node.js version

doesn't matter

MongoDB server version

doesn't matter

Typescript version (if applicable)

5.6.2

Description

InferSchemaType returns Buffer instead of Binary(from BSON) for Buffer field

Steps to Reproduce

const exampleSchema = new Schema({
    image: { type: Buffer },
});
export type Example = InferSchemaType<typeof exampleSchema>;
// type Example = {
//     image?: Buffer | null | undefined;
// }

Expected Behavior

type Example is:

type Example = {
    image?: Binary | null | undefined;
}

(Binary from BSON)

Metadata

Metadata

Assignees

No one assigned

    Labels

    helpThis issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions