Skip to content

Commit

Permalink
remove unused types
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj committed Aug 1, 2021
1 parent 254b1d5 commit 49746d6
Showing 1 changed file with 7 additions and 27 deletions.
34 changes: 7 additions & 27 deletions src/connection/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,48 @@ import {

import type {
GraphQLNamedType,
GraphQLScalarType,
GraphQLFieldConfigArgumentMap,
GraphQLFieldConfigMap,
GraphQLFieldResolver,
Thunk,
} from 'graphql';

interface ForwardConnectionArgs {
after: { type: GraphQLScalarType };
first: { type: GraphQLScalarType };
}

/**
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
* whose return type is a connection type with forward pagination.
*/
export const forwardConnectionArgs: ForwardConnectionArgs &
GraphQLFieldConfigArgumentMap = {
export const forwardConnectionArgs = {
after: {
type: GraphQLString,
// @ts-expect-error FIXME
description:
'Returns the items in the list that come after the specified cursor.',
},
first: {
type: GraphQLInt,
// @ts-expect-error FIXME
description: 'Returns the first n items from the list.',
},
};

interface BackwardConnectionArgs {
before: { type: GraphQLScalarType };
last: { type: GraphQLScalarType };
}
} as const;

/**
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
* whose return type is a connection type with backward pagination.
*/
export const backwardConnectionArgs: BackwardConnectionArgs &
GraphQLFieldConfigArgumentMap = {
export const backwardConnectionArgs = {
before: {
type: GraphQLString,
// @ts-expect-error FIXME
description:
'Returns the items in the list that come before the specified cursor.',
},
last: {
type: GraphQLInt,
// @ts-expect-error FIXME
description: 'Returns the last n items from the list.',
},
};
} as const;

/**
* Returns a GraphQLFieldConfigArgumentMap appropriate to include on a field
* whose return type is a connection type with bidirectional pagination.
*/
export const connectionArgs: BackwardConnectionArgs &
ForwardConnectionArgs &
GraphQLFieldConfigArgumentMap = {
export const connectionArgs = {
...forwardConnectionArgs,
...backwardConnectionArgs,
};
Expand Down Expand Up @@ -170,7 +150,7 @@ export interface Connection<T> {
/**
* A type designed to be exposed as a `Edge` over GraphQL.
*/
interface Edge<T> {
export interface Edge<T> {
node: T;
cursor: ConnectionCursor;
}
Expand Down Expand Up @@ -204,7 +184,7 @@ const pageInfoType = new GraphQLObjectType({
/**
* A type designed to be exposed as `PageInfo` over GraphQL.
*/
interface PageInfo {
export interface PageInfo {
startCursor: ConnectionCursor | null;
endCursor: ConnectionCursor | null;
hasPreviousPage: boolean;
Expand Down

0 comments on commit 49746d6

Please sign in to comment.