Skip to content

Commit

Permalink
fix(TypeScript): expose return type of composeMongoose (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
canac authored Aug 22, 2021
1 parent c7ee449 commit 89c5328
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/composeMongoose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,17 @@ export type GenerateResolverType<TDoc extends Document, TContext = any> = {
: any;
};

export type ObjectTypeComposerWithMongooseResolvers<
TDoc extends Document,
TContext = any
> = ObjectTypeComposer<TDoc, TContext> & {
mongooseResolvers: GenerateResolverType<TDoc, TContext>;
};

export function composeMongoose<TDoc extends Document, TContext = any>(
model: Model<TDoc>,
opts: ComposeMongooseOpts<TContext> = {}
): ObjectTypeComposer<TDoc, TContext> & {
mongooseResolvers: GenerateResolverType<TDoc, TContext>;
} {
): ObjectTypeComposerWithMongooseResolvers<TDoc, TContext> {
const m: Model<any> = model;
const name: string = (opts && opts.name) || m.modelName;

Expand Down

0 comments on commit 89c5328

Please sign in to comment.