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

Requiring Model required to Extend Document - Goes against Mongoose Recommenction #78

Open
gidich opened this issue Sep 9, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@gidich
Copy link

gidich commented Sep 9, 2021

According to current Mongoose's documentation, interfaces should not extend document:

https://mongoosejs.com/docs/typescript.html#using-extends-document

However type guards in the library require this.

export type Model<T, U = MongooseModel<T>> = T extends Document

Would you consider relaxing the type guards so that interfaces don't need to extend document?

@lorensr
Copy link
Member

lorensr commented Sep 13, 2021

Sure, what are the options for relaxing?

@lorensr lorensr added the enhancement New feature or request label Sep 13, 2021
@gidich
Copy link
Author

gidich commented Sep 30, 2021

I believe you can just remove the type constraint noting that T must extend Document.

export type Model<T, U = MongooseModel<T>>

I'll try tweaking things on my end and see if this works..

@lorensr
Copy link
Member

lorensr commented Oct 2, 2021

Thanks! Lmk how it goes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants