Merge pull request #28424 from joonhocho/patch-1

graphql-relay/index.d.ts: after, before, first, last can be null or undefined
This commit is contained in:
Mine Starks
2018-09-07 16:37:54 -07:00
committed by GitHub
+18 -18
View File
@@ -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;
};
/**
@@ -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;
}
/**
@@ -131,10 +131,10 @@ export interface Edge<T> {
* 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<T>(
* otherwise it will be the default.
*/
export function getOffsetWithDefault(
cursor?: ConnectionCursor,
defaultOffset?: number
cursor?: ConnectionCursor | null,
defaultOffset?: number | null
): number;
// mutation/mutation.js