Skip to content

Schema options as a function, return type help #15674

@skiv71

Description

@skiv71

Prerequisites

  • I have written a descriptive issue title

Mongoose version

8.19

Node.js version

24

MongoDB version

8

Operating system

None

Operating system version (i.e. 20.04, 11.3, 10)

No response

Issue

Since I'd like to override the default schema options on all my schema models, I thought it would be a good idea to create an object (const or function call) and since these are done in abstraction, I have to Type the const / function return type.

Thought I could get away with mongoose.SchemaOptions... but then intellisense spits it's dummy out.

I look at the source and the warning and I'm still none the wiser on how to Type this...

On the face of it, these typings in the source look very complex... and I can't see it documented.

Any pointers? Or is there a factory fn to help?

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions