From 973d78b87544b71c10d3e2c63f313f8b00e18022 Mon Sep 17 00:00:00 2001 From: Joon Ho Cho Date: Mon, 27 Aug 2018 04:10:38 -0700 Subject: [PATCH 1/2] Update index.d.ts before, last, after, first can be null or undefined --- types/graphql-relay/index.d.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/types/graphql-relay/index.d.ts b/types/graphql-relay/index.d.ts index fc1eb3aa1e..16ebfd099e 100644 --- a/types/graphql-relay/index.d.ts +++ b/types/graphql-relay/index.d.ts @@ -34,12 +34,12 @@ import { * whose return type is a connection type with forward pagination. */ export interface ForwardConnectionArgs { - after: ConnectionCursor; - first: number; + after?: ConnectionCursor | null; + first?: number | null; } export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap & { - after: ConnectionCursor; - first: number; + after?: ConnectionCursor | null; + first?: number | null; }; /** @@ -47,12 +47,12 @@ export const forwardConnectionArgs: GraphQLFieldConfigArgumentMap & { * whose return type is a connection type with backward pagination. */ export interface BackwardConnectionArgs { - before: ConnectionCursor; - last: number; + before?: ConnectionCursor | null; + last?: number | null; } export const backwardConnectionArgs: GraphQLFieldConfigArgumentMap & { - before: ConnectionCursor; - last: number; + before?: ConnectionCursor | null; + last?: number | null; }; /** @@ -131,10 +131,10 @@ export interface Edge { * A flow type describing the arguments a connection field receives in GraphQL. */ export interface ConnectionArguments { - before?: ConnectionCursor; - after?: ConnectionCursor; - first?: number; - last?: number; + before?: ConnectionCursor | null; + after?: ConnectionCursor | null; + first?: number | null; + last?: number | null; } // connection/arrayconnection.js @@ -212,8 +212,8 @@ export function cursorForObjectInConnection( * otherwise it will be the default. */ export function getOffsetWithDefault( - cursor?: ConnectionCursor, - defaultOffset?: number + cursor?: ConnectionCursor | null, + defaultOffset?: number | null ): number; // mutation/mutation.js From 0561065dc458f3e4d23a9ab405b235f7f0e29f5f Mon Sep 17 00:00:00 2001 From: Joon Ho Cho Date: Mon, 27 Aug 2018 04:24:04 -0700 Subject: [PATCH 2/2] Update index.d.ts --- types/graphql-relay/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/graphql-relay/index.d.ts b/types/graphql-relay/index.d.ts index 16ebfd099e..842e1ad4f1 100644 --- a/types/graphql-relay/index.d.ts +++ b/types/graphql-relay/index.d.ts @@ -105,10 +105,10 @@ export type ConnectionCursor = string; * A flow type designed to be exposed as `PageInfo` over GraphQL. */ export interface PageInfo { - startCursor: ConnectionCursor; - endCursor: ConnectionCursor; - hasPreviousPage: boolean; - hasNextPage: boolean; + startCursor?: ConnectionCursor | null; + endCursor?: ConnectionCursor | null; + hasPreviousPage?: boolean | null; + hasNextPage?: boolean | null; } /**