From 89c532873637a1a1fbba010548314a83d5d0c3bc Mon Sep 17 00:00:00 2001 From: Caleb Cox Date: Sun, 22 Aug 2021 12:15:42 -0500 Subject: [PATCH] fix(TypeScript): expose return type of composeMongoose (#369) --- src/composeMongoose.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/composeMongoose.ts b/src/composeMongoose.ts index 456f0458..ddc69ee8 100644 --- a/src/composeMongoose.ts +++ b/src/composeMongoose.ts @@ -98,12 +98,17 @@ export type GenerateResolverType = { : any; }; +export type ObjectTypeComposerWithMongooseResolvers< + TDoc extends Document, + TContext = any +> = ObjectTypeComposer & { + mongooseResolvers: GenerateResolverType; +}; + export function composeMongoose( model: Model, opts: ComposeMongooseOpts = {} -): ObjectTypeComposer & { - mongooseResolvers: GenerateResolverType; -} { +): ObjectTypeComposerWithMongooseResolvers { const m: Model = model; const name: string = (opts && opts.name) || m.modelName;