Skip to content

Commit

Permalink
fix: typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Sep 14, 2020
1 parent 7e6ad00 commit 389a438
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/composeWithConnection.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ObjectTypeComposer } from 'graphql-compose';
import { prepareConnectionResolver } from './connection';
import type { ComposeWithConnectionOpts } from './connection';
import type { ConnectionResolverOpts } from './connection';

export function composeWithConnection<TSource, TContext>(
typeComposer: ObjectTypeComposer<TSource, TContext>,
opts: ComposeWithConnectionOpts<TContext>
opts: ConnectionResolverOpts<TContext>
): ObjectTypeComposer<TSource, TContext> {
if (!(typeComposer instanceof ObjectTypeComposer)) {
throw new Error('You should provide ObjectTypeComposer instance to composeWithRelay method');
Expand Down
8 changes: 4 additions & 4 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { prepareConnectionType, PageInfoType, ConnectionType } from './types/con
import { prepareSortType } from './types/sortInputType';
import { cursorToData, dataToCursor, CursorDataType } from './cursor';

export type ComposeWithConnectionOpts<TContext> = {
export type ConnectionResolverOpts<TContext> = {
findManyResolver: Resolver;
countResolver: Resolver;
sort: ConnectionSortMapOpts;
Expand Down Expand Up @@ -44,14 +44,14 @@ export interface ConnectionTArgs {
after?: string;
last?: number | null;
before?: string;
sort?: ConnectionSortOpts;
filter?: { [fieldName: string]: any };
sort?: Record<string, any>;
filter?: Record<string, any>;
[argName: string]: any;
}

export function prepareConnectionResolver<TSource, TContext>(
tc: ObjectTypeComposer<TSource, TContext>,
opts: ComposeWithConnectionOpts<TContext>
opts: ConnectionResolverOpts<TContext>
): Resolver<TSource, TContext> {
if (!(tc instanceof 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 @@ -7,7 +7,7 @@ export default composeWithConnection;
export { composeWithConnection, prepareConnectionResolver, cursorToData, dataToCursor };

export type {
ComposeWithConnectionOpts,
ConnectionResolverOpts,
ConnectionSortOpts,
ConnectionSortMapOpts,
ConnectionTArgs,
Expand Down
4 changes: 2 additions & 2 deletions src/types/sortInputType.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ObjectTypeComposer, upperFirst, isFunction, EnumTypeComposer } from 'graphql-compose';
import type { ConnectionSortOpts, ComposeWithConnectionOpts } from '../connection';
import type { ConnectionSortOpts, ConnectionResolverOpts } from '../connection';

export function prepareSortType<TContext>(
typeComposer: ObjectTypeComposer<any, TContext>,
opts: ComposeWithConnectionOpts<TContext>
opts: ConnectionResolverOpts<TContext>
): EnumTypeComposer<TContext> {
if (!opts || !opts.sort) {
throw new Error('Option `sort` should not be empty in composeWithConnection');
Expand Down

0 comments on commit 389a438

Please sign in to comment.