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
Get Document type with QueryHelpers and InstanceMethods #12319
Labels
typescript
Types or Types-test related issue / Pull Request
Milestone
Comments
kot-shrodingera
added
help
This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary
help wanted
labels
Aug 23, 2022
kot-shrodingera
changed the title
Get Document type
Get Document type with QueryHelpers and InstanceMethods
Aug 23, 2022
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 |
This issue was closed because it has been inactive for 19 days since being marked as stale. |
vkarpov15
added
typescript
Types or Types-test related issue / Pull Request
and removed
help
This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary
help wanted
Stale
labels
Sep 14, 2022
vkarpov15
added a commit
that referenced
this issue
Sep 22, 2022
…inferred hydrated doc type Fix #12319
vkarpov15
added a commit
that referenced
this issue
Sep 26, 2022
fix(types): add HydratedDocumentFromSchema to make it easier to pull inferred hydrated doc type
I guess it's not quite right. Methods are infered, but virtuals aren't export type HydratedDocumentFromSchema<TSchema extends Schema> = HydratedDocument<
InferSchemaType<TSchema>,
ObtainSchemaGeneric<TSchema, 'TInstanceMethods'>,
ObtainSchemaGeneric<TSchema, 'TVirtuals'>
>; ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Prerequisites
Mongoose version
6.5.2
Node.js version
17.3
MongoDB version
5.0
Operating system
Windows
Operating system version (i.e. 20.04, 11.3, 10)
11
Issue
How can I get infered Document type in typescript? So I could use it as argument type in DTO or enywhere else. For example I have this:
Basically, I want a return type of
await ProjectModel.findOne()
. Closest I got is:But it looks bulky. Is there another way?
The text was updated successfully, but these errors were encountered: