GraphQLGuide / apollo-datasource-mongodb

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

findByFields returns a Union of (T | undefined | null)[] #94

Open tr3ysmith opened 2 years ago

tr3ysmith commented 2 years ago

Why does the findByFields() and other functions provided by "this" return a union of the (TData, undefined, and null)[]?

Why not just TData[]?

image

RemyMachado commented 2 years ago

If this raise a type error with your resolvers typed with graphql-code-generator, I can recommend you this comment.