[Types] Typing for Schema.discriminator
does not include options
parameter
#15244
Closed
2 tasks done
Labels
typescript
Types or Types-test related issue / Pull Request
Milestone
Prerequisites
Mongoose version
8.10.0
Node.js version
22.12.0
MongoDB server version
6.13.0
Typescript version (if applicable)
5.7.3
Description
The types for
Schema.discriminator
only allow 2 parameters (name
andschema
):But in the actual code, it is clear that the function accepts an additional parameter (
options
):This discrepancy in the types makes it so users cannot specify different
name
andvalue
without typecasting:(Which incidentally, is the best workaround for #7422)
Steps to Reproduce
Try to create a discriminator on a Schema with a different name and value.
Expected Behavior
Types should reflect actual code.
The text was updated successfully, but these errors were encountered: