Open sojharo opened 2 years ago
I'm having similar error
I have found a workaround for this but it is discouraged by Mongoose documentation here.
Workaround is to extend your interface with Document:
import { Document } from "mongoose";
export interface Listing extends Document {
_id: ObjectId;
name: string;
description: string[];
}
I am not good with TypeScript so I just don't know how to fix this in library. But, I think we need to do something here: https://github.com/GraphQLGuide/apollo-datasource-mongodb/blob/master/index.d.ts#L18
I'd be happy to look at a PR for this!
I tried using the same mongoose version for my application as specified for apollo-datasource-mongodb
but to no avail.
@lorensr can you please review the following PR: https://github.com/GraphQLGuide/apollo-datasource-mongodb/pull/110
I am getting this weird typescript error when I put Mongoose Model in constructor.
My Listing Model is defined like this:
My Mongoose Model is defined like this:
My Listing Interfact is defined like this:
But when I pass my Mongoose Model to DataSource based class. I get following TypScript error:
I have tried many ways but this is not getting solved.