Schema.path() always returns SchemaType and not the specific type of the supplied path #11987
Closed
2 tasks done
Labels
typescript
Types or Types-test related issue / Pull Request
Milestone
Prerequisites
Mongoose version
6.4.0
Node.js version
16.8.0
MongoDB server version
5.x
Description
When I try to run
Schema.path()
on a mongoose Schema, I always get the result asSchemaType
. However, in the types, I see many specific classes that extend SchemaType and have extra methods such asdiscriminator
. I don't know if I'm doing something wrong, but I assume that TypeScript won't throw errors if correctSchemaType
is sent as the resultant type ofpath()
Steps to Reproduce
Sample code to reproduce -
The text was updated successfully, but these errors were encountered: