Skip to content

docs(typescript): correct schema and model generic params in TS virtuals docs #15391

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

Merged
merged 2 commits into from
May 5, 2025

Conversation

vkarpov15
Copy link
Collaborator

Fix mongoosejs/mongoose-lean-virtuals#74

Summary

In mongoosejs/mongoose-lean-virtuals#74, OP pointed out that https://mongoosejs.com/docs/typescript/virtuals.html#set-virtuals-type-manually sets virtuals using the incorrect generic param.

Also we originally added virtuals.html in #10754 but didn't add a link from navbar

Examples

@vkarpov15 vkarpov15 added this to the 8.14.2 milestone May 1, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the TypeScript virtuals documentation to correct the generic parameter order for Mongoose model and schema declarations. It fixes the type signature for both the UserModel and the schema instantiation while maintaining inline comments for clarity.

Files not reviewed (1)
  • docs/layout.pug: Language not supported

@hasezoey hasezoey added docs This issue is due to a mistake or omission in the mongoosejs.com documentation typescript Types or Types-test related issue / Pull Request labels May 2, 2025
@vkarpov15 vkarpov15 merged commit 986dce1 into master May 5, 2025
1 check passed
@vkarpov15 vkarpov15 deleted the vkarpov15/mongoosejs-lean-virtuals#74 branch May 5, 2025 21:59
mergify bot added a commit to reisene/HulajDusza-serwis that referenced this pull request Jun 9, 2025
![snyk-io[bot]](https://badgen.net/badge/icon/snyk-io%5Bbot%5D/green?label=)
![Contributor](https://badgen.net/badge/icon/Contributor/000000?label=)
[<img width="16" alt="Powered by Pull Request Badge"
src="https://user-images.githubusercontent.com/1393946/111216524-d2bb8e00-85d4-11eb-821b-ed4c00989c02.png">](https://pullrequestbadge.com/?utm_medium=github&utm_source=reisene&utm_campaign=badge_info)<!--
PR-BADGE: PLEASE DO NOT REMOVE THIS COMMENT -->


![snyk-top-banner](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)


<h3>Snyk has created this PR to upgrade mongoose from 8.14.2 to
8.14.3.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>


- The recommended version is **1 version** ahead of your current
version.

- The recommended version was released **23 days ago**.



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>mongoose</b></summary>
    <ul>
      <li>
<b>8.14.3</b> - <a
href="https://redirect.github.com/Automattic/mongoose/releases/tag/8.14.3">2025-05-13</a></br><h1>8.14.3
/ 2025-05-13</h1>
<ul>
<li>types(schema): allow post('init') <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3049961081" data-permission-text="Title is private"
data-url="Automattic/mongoose#15413"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15413/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15413">#15413</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3049127827" data-permission-text="Title is private"
data-url="Automattic/mongoose#15412"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15412/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15412">#15412</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="2956580603" data-permission-text="Title is private"
data-url="Automattic/mongoose#15333"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15333/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15333">#15333</a></li>
<li>types: fix signature of DocumentArray.id <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3050874869" data-permission-text="Title is private"
data-url="Automattic/mongoose#15414"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15414/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15414">#15414</a>
<a href="https://redirect.github.com/Sainan">Sainan</a></li>
<li>docs: fix typo - change 'prodecure' to 'procedure' <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="3059701782" data-permission-text="Title is private"
data-url="Automattic/mongoose#15419"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15419/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15419">#15419</a>
<a href="https://redirect.github.com/0xEbrahim">0xEbrahim</a></li>
</ul>
      </li>
      <li>
<b>8.14.2</b> - <a
href="https://redirect.github.com/Automattic/mongoose/releases/tag/8.14.2">2025-05-08</a></br><h1>8.14.2
/ 2025-05-08</h1>
<ul>
<li>fix(query): handle casting array filter paths underneath array
filter paths with embedded discriminators <a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="3032109299" data-permission-text="Title is private"
data-url="Automattic/mongoose#15388"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15388/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15388">#15388</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="3030764860" data-permission-text="Title is private"
data-url="Automattic/mongoose#15386"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/15386/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/15386">#15386</a></li>
<li>docs(typescript): correct schema and model generic params in TS
virtuals docs <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3034576277"
data-permission-text="Title is private"
data-url="Automattic/mongoose#15391"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15391/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15391">#15391</a></li>
<li>docs+types(schema): add alternative optimisticConcurrency syntaxes
to docs + types <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3040923211"
data-permission-text="Title is private"
data-url="Automattic/mongoose#15405"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15405/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15405">#15405</a>
<a class="issue-link js-issue-link" data-error-text="Failed to load
title" data-id="977085280" data-permission-text="Title is private"
data-url="Automattic/mongoose#10591"
data-hovercard-type="issue"
data-hovercard-url="/Automattic/mongoose/issues/10591/hovercard"
href="https://redirect.github.com/Automattic/mongoose/issues/10591">#10591</a></li>
<li>chore: add Node 24 to CI matrix <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="3044942226"
data-permission-text="Title is private"
data-url="Automattic/mongoose#15408"
data-hovercard-type="pull_request"
data-hovercard-url="/Automattic/mongoose/pull/15408/hovercard"
href="https://redirect.github.com/Automattic/mongoose/pull/15408">#15408</a>
<a href="https://redirect.github.com/stscoundrel">stscoundrel</a></li>
</ul>
      </li>
    </ul>
from <a
href="https://redirect.github.com/Automattic/mongoose/releases">mongoose
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI1OTM5YTZhZi1hYTQ4LTQ3MzEtYjE2Ny01Zjk4NmRjY2VkYTgiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjU5MzlhNmFmLWFhNDgtNDczMS1iMTY3LTVmOTg2ZGNjZWRhOCJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/reisene/project/55e114f8-489e-4f14-b900-20574b041e59?utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/reisene/project/55e114f8-489e-4f14-b900-20574b041e59/settings/integration?utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/reisene/project/55e114f8-489e-4f14-b900-20574b041e59/settings/integration?pkg&#x3D;mongoose&amp;utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"mongoose","from":"8.14.2","to":"8.14.3"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"5939a6af-aa48-4731-b167-5f986dcceda8","prPublicId":"5939a6af-aa48-4731-b167-5f986dcceda8","packageManager":"npm","priorityScoreList":[],"projectPublicId":"55e114f8-489e-4f14-b900-20574b041e59","projectUrl":"https://app.snyk.io/org/reisene/project/55e114f8-489e-4f14-b900-20574b041e59?utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2025-05-13T15:27:19.721Z"},"vulns":[]}'

## Podsumowanie od Sourcery

Prace porządkowe:
- Aktualizacja mongoose z wersji 8.14.2 do 8.14.3 w pliku package.json

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Chores:
- Bump mongoose from 8.14.2 to 8.14.3 in package.json

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation typescript Types or Types-test related issue / Pull Request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instructions for typescript
2 participants