Automattic / mongoose

MongoDB object modeling designed to work in an asynchronous environment.
https://mongoosejs.com
MIT License
26.84k stars 3.82k forks source link

Library Type Matching Issue on WebStorm #14741

Closed Vasile-Peste closed 2 weeks ago

Vasile-Peste commented 1 month ago

Prerequisites

Mongoose version

8.4.4

Node.js version

20

MongoDB version

7

Operating system

macOS

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

No response

Issue

Hello,

Screenshot 2024-07-11 at 18 09 25

I'm using WebStorm 2024.1.5

"mongoose": "^8.4.4", "@types/mongoose": "^5.11.97",

I don't understand if it's an issue of Mongoose or the IDE, but basically it happens only with Mongoose: for every method, it's like all the optional parameters are marked as required

Can someone help me? Thanks!

vkarpov15 commented 1 month ago

Why do you have @types/mongoose installed? That might be causing some issues.

Vasile-Peste commented 1 month ago

Why do you have @types/mongoose installed? That might be causing some issues.

I also tried without it but the issue persists

vkarpov15 commented 1 month ago

Does this issue occur when you compile with TypeScript or is it just your IDE? As a general rule, we don't debug autocomplete issues in IDEs, especially since our TypeScript types do define 0-3 argument overrides for Model.findOne().

If this causes trouble for you, you can use Poll.findOne({ _id: pollId }, null, { lean: true, session: mongoSession }) instead of chaining .lean().session().

github-actions[bot] commented 3 weeks ago

This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days

github-actions[bot] commented 2 weeks ago

This issue was closed because it has been inactive for 19 days and has been marked as stale.