Skip to content

Commit

Permalink
fix: deprecate composeWithPagination method for TS 4.0 users; renam…
Browse files Browse the repository at this point in the history
…e Opts typename
  • Loading branch information
nodkz committed Sep 14, 2020
1 parent 32ebd92 commit 3e83003
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions src/composeWithPagination.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { ObjectTypeComposer } from 'graphql-compose';
import {
preparePaginationResolver,
ComposeWithPaginationOpts,
PaginationResolverOpts,
DEFAULT_RESOLVER_NAME,
} from './pagination';

/**
* @deprecated use `preparePaginationResolver()` instead
*/
export function composeWithPagination<TSource, TContext>(
typeComposer: ObjectTypeComposer<TSource, TContext>,
opts: ComposeWithPaginationOpts
opts: PaginationResolverOpts
): ObjectTypeComposer<TSource, TContext> {
if (!typeComposer || typeComposer.constructor.name !== 'ObjectTypeComposer') {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { composeWithPagination } from './composeWithPagination';
export { composeWithPagination, preparePaginationResolver };

export type {
ComposeWithPaginationOpts,
PaginationResolverOpts,
PaginationTArgs,
PaginationType,
PaginationInfoType,
Expand Down
4 changes: 2 additions & 2 deletions src/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { preparePaginationTC } from './types';
export const DEFAULT_RESOLVER_NAME = 'pagination';
export const DEFAULT_PER_PAGE = 20;

export type ComposeWithPaginationOpts = {
export type PaginationResolverOpts = {
findManyResolver: Resolver;
countResolver: Resolver;
name?: string;
Expand Down Expand Up @@ -40,7 +40,7 @@ export interface PaginationTArgs {

export function preparePaginationResolver<TSource, TContext>(
tc: ObjectTypeComposer<TSource, TContext>,
opts: ComposeWithPaginationOpts
opts: PaginationResolverOpts
): Resolver<TSource, TContext, PaginationTArgs> {
if (!tc || tc.constructor.name !== 'ObjectTypeComposer') {
throw new Error(
Expand Down

0 comments on commit 3e83003

Please sign in to comment.