-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript returns an error if you run a query on a subclass field of a model #14842
Closed
2 tasks done
Labels
typescript
Types or Types-test related issue / Pull Request
Milestone
Comments
vkarpov15
added
the
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
label
Aug 29, 2024
2 tasks
vkarpov15
added
typescript
Types or Types-test related issue / Pull Request
and removed
has repro script
There is a repro script, the Mongoose devs need to confirm that it reproduces the issue
labels
Sep 10, 2024
Fixed by #14874 |
This was referenced Oct 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Mongoose version
8.6.0
Node.js version
20.10.0
MongoDB server version
6.0.2
Typescript version (if applicable)
5.5.4
Description
First of all, I find the new feature introduced by the minor release 8.6.0 very useful, which checks if fields exist in the main interface of the model when running queries! It’s a great idea!
However, I encountered a problem with models and subclasses: before 8.6.0, it was possible to run a query on a subclass field from the main model, but now TypeScript reports an error (solved old issue).
interfaces:
query:
Steps to Reproduce
Reproduction link: https://stackblitz.com/edit/vitejs-vite-jkwelc?file=src%2Findex.ts
Expected Behavior
Although the main interface does not include the fields of the subclasses, you should still be able to run a query from the main model, as it worked prior to version 8.6.0.
The text was updated successfully, but these errors were encountered: