-
-
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
Fix: Mongoose slows down performance of VSCode (TSServer) by a lot #1… #10801
Conversation
From what I can tell, this PR makes TS slower, not faster.
After this change:
Furthermore, it breaks our tests because we need to support Although I'm unable to confirm that this improves performance in any way, I don't see much harm to merging this as long as you can confirm that changing |
|
We'll try this out and see if it helps. I honestly haven't been able to confirm the performance degradation by eyeballing VS Code, but I don't see any harm in merging this. |
Use And use 5.10.11 version , everything is cool ~ |
Addressing issue: Mongoose slows down performance of VSCode (TSServer) by a lot #10349
Changing
Schema<any>
toSchema<T>
inmodel
seems to solve this problem. The othermodel
overload already uses the generic in the schema parameter.Examples:
Gists show two simple schemas based on the mongoose documentation: https://gist.github.com/traverse1984/ee57740a87374188851b30b4286a47fa
Notes:
Without trying to get to grips with the entire set of mongoose typings, it seems that mismatched Schema/Model types cause the slowdown. I believe (but am not certain), that the
Schema<any>
in the function parameter was causing this to happen, despite the return type being correct. I noted that the Schema interface creates a model with 'any' types, but the defaults for the Model interface generics are {}.