Skip to content

Commit 389a438

Browse files
committed
fix: typescript definitions
1 parent 7e6ad00 commit 389a438

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/composeWithConnection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { ObjectTypeComposer } from 'graphql-compose';
22
import { prepareConnectionResolver } from './connection';
3-
import type { ComposeWithConnectionOpts } from './connection';
3+
import type { ConnectionResolverOpts } from './connection';
44

55
export function composeWithConnection<TSource, TContext>(
66
typeComposer: ObjectTypeComposer<TSource, TContext>,
7-
opts: ComposeWithConnectionOpts<TContext>
7+
opts: ConnectionResolverOpts<TContext>
88
): ObjectTypeComposer<TSource, TContext> {
99
if (!(typeComposer instanceof ObjectTypeComposer)) {
1010
throw new Error('You should provide ObjectTypeComposer instance to composeWithRelay method');

src/connection.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { prepareConnectionType, PageInfoType, ConnectionType } from './types/con
1010
import { prepareSortType } from './types/sortInputType';
1111
import { cursorToData, dataToCursor, CursorDataType } from './cursor';
1212

13-
export type ComposeWithConnectionOpts<TContext> = {
13+
export type ConnectionResolverOpts<TContext> = {
1414
findManyResolver: Resolver;
1515
countResolver: Resolver;
1616
sort: ConnectionSortMapOpts;
@@ -44,14 +44,14 @@ export interface ConnectionTArgs {
4444
after?: string;
4545
last?: number | null;
4646
before?: string;
47-
sort?: ConnectionSortOpts;
48-
filter?: { [fieldName: string]: any };
47+
sort?: Record<string, any>;
48+
filter?: Record<string, any>;
4949
[argName: string]: any;
5050
}
5151

5252
export function prepareConnectionResolver<TSource, TContext>(
5353
tc: ObjectTypeComposer<TSource, TContext>,
54-
opts: ComposeWithConnectionOpts<TContext>
54+
opts: ConnectionResolverOpts<TContext>
5555
): Resolver<TSource, TContext> {
5656
if (!(tc instanceof ObjectTypeComposer)) {
5757
throw new Error(

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default composeWithConnection;
77
export { composeWithConnection, prepareConnectionResolver, cursorToData, dataToCursor };
88

99
export type {
10-
ComposeWithConnectionOpts,
10+
ConnectionResolverOpts,
1111
ConnectionSortOpts,
1212
ConnectionSortMapOpts,
1313
ConnectionTArgs,

src/types/sortInputType.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { ObjectTypeComposer, upperFirst, isFunction, EnumTypeComposer } from 'graphql-compose';
2-
import type { ConnectionSortOpts, ComposeWithConnectionOpts } from '../connection';
2+
import type { ConnectionSortOpts, ConnectionResolverOpts } from '../connection';
33

44
export function prepareSortType<TContext>(
55
typeComposer: ObjectTypeComposer<any, TContext>,
6-
opts: ComposeWithConnectionOpts<TContext>
6+
opts: ConnectionResolverOpts<TContext>
77
): EnumTypeComposer<TContext> {
88
if (!opts || !opts.sort) {
99
throw new Error('Option `sort` should not be empty in composeWithConnection');

0 commit comments

Comments
 (0)