diff --git a/src/with-filter.ts b/src/with-filter.ts index c881533..dc5af0c 100644 --- a/src/with-filter.ts +++ b/src/with-filter.ts @@ -1,20 +1,20 @@ -export type FilterFn = (rootValue?: TSource, args?: TArgs, context?: TContext, info?: any) => boolean | Promise; -export type ResolverFn = (rootValue?: TSource, args?: TArgs, context?: TContext, info?: any) => AsyncIterator | Promise>; -export type IterableResolverFn = (rootValue?: TSource, args?: TArgs, context?: TContext, info?: any) => AsyncIterableIterator | Promise>; +export type FilterFn = (rootValue: TSource, args: TArgs, context: TContext, info?: any) => boolean | Promise; +export type ResolverFn = (rootValue: TSource, args: TArgs, context: TContext, info?: any) => AsyncIterator | Promise>; +export type IterableResolverFn = (rootValue: TSource, args: TArgs, context: TContext, info?: any) => AsyncIterableIterator | Promise>; interface IterallAsyncIterator extends AsyncIterableIterator { [Symbol.asyncIterator](): IterallAsyncIterator; } -export type WithFilter = ( - asyncIteratorFn: ResolverFn, - filterFn: FilterFn +export type WithFilter = ( + asyncIteratorFn: ResolverFn, + filterFn: FilterFn ) => IterableResolverFn; -export function withFilter( - asyncIteratorFn: ResolverFn, - filterFn: FilterFn -): IterableResolverFn { + export function withFilter( + asyncIteratorFn: ResolverFn, + filterFn: FilterFn + ): IterableResolverFn { return async (rootValue: TSource, args: TArgs, context: TContext, info: any): Promise> => { const asyncIterator = await asyncIteratorFn(rootValue, args, context, info);