Skip to content
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

types: make property names show up in intellisense for UpdateQuery #14123

Merged
merged 1 commit into from Nov 26, 2023

Conversation

vkarpov15
Copy link
Collaborator

Fix #14090

Summary

I took a look, and with this changes it looks like intellisense picks up property names as well as update operators
image

Examples

@vkarpov15 vkarpov15 added the developer-experience This issue improves error messages, debugging, or reporting label Nov 25, 2023
@vkarpov15 vkarpov15 added this to the 8.0.2 milestone Nov 25, 2023
@pshaddel
Copy link
Contributor

@vkarpov15 I think this change cast types to any. But this one gives the complete typing, even inside the objects:
index.d.ts

type _UpdateQuery<TSchema, AdditionalProperties = AnyObject> = TSchema | {

Maybe using something like NestedPartial on TSchema:

type _UpdateQuery<TSchema, AdditionalProperties = AnyObject> = Partial<TSchema> | {

@vkarpov15
Copy link
Collaborator Author

This doesn't change the cast type at all, you still end up with AnyObject at the end; just helps with intellisense. I'm open to alternatives, and Partial<TSchema> | AnyObject may be better in some cases, but the approach in this PR is likely the minimum viable change and I don't see any reason why Partial<TSchema> | AnyObject would be better.

@pshaddel
Copy link
Contributor

I thought, this issue is complaining about the types:
#14090 (comment)

What you said is true, the only way is to replace AnyObject(which i guess breaks some stuff).

@hasezoey hasezoey added the typescript Types or Types-test related issue / Pull Request label Nov 26, 2023
@hasezoey
Copy link
Collaborator

should this fix maybe be targeted at 7.x too?

@vkarpov15
Copy link
Collaborator Author

@hasezoey yeah I'll cherry pick

@vkarpov15 vkarpov15 merged commit 84db3a0 into master Nov 26, 2023
3 checks passed
@hasezoey hasezoey deleted the vkarpov15/gh-14090 branch November 26, 2023 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer-experience This issue improves error messages, debugging, or reporting typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript IntelliSense not working for model.updateOne second parameter
3 participants