apollo-datasource-mongodb
apollo-datasource-mongodb copied to clipboard
Requiring Model required to Extend Document - Goes against Mongoose Recommenction
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.
https://github.com/GraphQLGuide/apollo-datasource-mongodb/blob/4e1124d1ebb9665ae1dfeb80a92cf8eb9a5db3b7/index.d.ts#L14
Would you consider relaxing the type guards so that interfaces don't need to extend document?
Sure, what are the options for relaxing?
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..
Thanks! Lmk how it goes