GraphQLGuide / apollo-datasource-mongodb

Apollo data source for MongoDB
MIT License
285 stars 64 forks source link

Typescript Generic type error #49

Closed stretch0 closed 3 years ago

stretch0 commented 3 years ago

Trying to use MongoDataSource to extend my User dataSource class with typescript but seem to be getting the following error:

Generic type 'MongoDataSource<TData, TContext>' requires between 1 and 2 type arguments.ts(2707)

My User dataSrouce class is as so:

export default class Users extends MongoDataSource { }

How am I supposed to call MongoDataSource with 2 args when it's used to extend my own class?

9at8 commented 3 years ago

Hey @stretch0 ! Have you tried something like the example in the readme? https://github.com/GraphQLGuide/apollo-datasource-mongodb#typescript

Let me know if you have any other questions! 😀

stretch0 commented 3 years ago

That has done the trick.

Thanks for your help 😄