Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove maybe types #300

Merged
merged 1 commit into from
Mar 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/connection/arrayconnection.d.ts
Original file line number Diff line number Diff line change
@@ -70,7 +70,7 @@ export function cursorToOffset(cursor: ConnectionCursor): number;
export function cursorForObjectInConnection<T>(
data: ReadonlyArray<T>,
object: T,
): ConnectionCursor | null | undefined;
): ConnectionCursor | null;

/**
* Given an optional cursor and a default offset, returns the offset
2 changes: 1 addition & 1 deletion src/connection/arrayconnection.js
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ export function cursorToOffset(cursor: ConnectionCursor): number {
export function cursorForObjectInConnection<T>(
data: $ReadOnlyArray<T>,
object: T,
): ?ConnectionCursor {
): ConnectionCursor | null {
const offset = data.indexOf(object);
if (offset === -1) {
return null;
10 changes: 5 additions & 5 deletions src/connection/connection.d.ts
Original file line number Diff line number Diff line change
@@ -42,12 +42,12 @@ export const connectionArgs: GraphQLFieldConfigArgumentMap &
BackwardConnectionArgs;

export interface ConnectionConfig {
name?: string | null;
name?: string;
nodeType: GraphQLObjectType;
resolveNode?: GraphQLFieldResolver<any, any> | null;
resolveCursor?: GraphQLFieldResolver<any, any> | null;
edgeFields?: Thunk<GraphQLFieldConfigMap<any, any>> | null;
connectionFields?: Thunk<GraphQLFieldConfigMap<any, any>> | null;
resolveNode?: GraphQLFieldResolver<any, any>;
resolveCursor?: GraphQLFieldResolver<any, any>;
edgeFields?: Thunk<GraphQLFieldConfigMap<any, any>>;
connectionFields?: Thunk<GraphQLFieldConfigMap<any, any>>;
}

export interface GraphQLConnectionDefinitions {
10 changes: 5 additions & 5 deletions src/connection/connection.js
Original file line number Diff line number Diff line change
@@ -52,12 +52,12 @@ export const connectionArgs: GraphQLFieldConfigArgumentMap = {
};

type ConnectionConfig = {
name?: ?string,
name?: string,
nodeType: GraphQLObjectType,
resolveNode?: ?GraphQLFieldResolver<any, any>,
resolveCursor?: ?GraphQLFieldResolver<any, any>,
edgeFields?: ?Thunk<GraphQLFieldConfigMap<any, any>>,
connectionFields?: ?Thunk<GraphQLFieldConfigMap<any, any>>,
resolveNode?: GraphQLFieldResolver<any, any>,
resolveCursor?: GraphQLFieldResolver<any, any>,
edgeFields?: Thunk<GraphQLFieldConfigMap<any, any>>,
connectionFields?: Thunk<GraphQLFieldConfigMap<any, any>>,
};

type GraphQLConnectionDefinitions = {
8 changes: 4 additions & 4 deletions src/connection/connectiontypes.d.ts
Original file line number Diff line number Diff line change
@@ -7,10 +7,10 @@ export type ConnectionCursor = string;
* A flow type designed to be exposed as `PageInfo` over GraphQL.
*/
export interface PageInfo {
startCursor?: ConnectionCursor | null;
endCursor?: ConnectionCursor | null;
hasPreviousPage?: boolean | null;
hasNextPage?: boolean | null;
startCursor: ConnectionCursor | null;
endCursor: ConnectionCursor | null;
hasPreviousPage: boolean;
hasNextPage: boolean;
}

/**
16 changes: 8 additions & 8 deletions src/connection/connectiontypes.js
Original file line number Diff line number Diff line change
@@ -9,10 +9,10 @@ export type ConnectionCursor = string;
* A flow type designed to be exposed as `PageInfo` over GraphQL.
*/
export type PageInfo = {
startCursor: ?ConnectionCursor,
endCursor: ?ConnectionCursor,
hasPreviousPage: ?boolean,
hasNextPage: ?boolean,
startCursor: ConnectionCursor | null,
endCursor: ConnectionCursor | null,
hasPreviousPage: boolean,
hasNextPage: boolean,
};

/**
@@ -35,9 +35,9 @@ export type Edge<T> = {
* A flow type describing the arguments a connection field receives in GraphQL.
*/
export type ConnectionArguments = {
before?: ?ConnectionCursor,
after?: ?ConnectionCursor,
first?: ?number,
last?: ?number,
before?: ConnectionCursor | null,
after?: ConnectionCursor | null,
first?: number | null,
last?: number | null,
...
};
4 changes: 2 additions & 2 deletions src/node/node.d.ts
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ export interface GraphQLNodeDefinitions<TContext> {
*/
export function nodeDefinitions<TContext>(
idFetcher: (id: string, context: TContext, info: GraphQLResolveInfo) => any,
typeResolver?: GraphQLTypeResolver<any, TContext> | null,
typeResolver?: GraphQLTypeResolver<any, TContext>,
): GraphQLNodeDefinitions<TContext>;

// TS_SPECIFIC: This type is only exported by TypeScript
@@ -52,6 +52,6 @@ export function fromGlobalId(globalId: string): ResolvedGlobalId;
* property on the object.
*/
export function globalIdField(
typeName?: string | null,
typeName?: string,
idFetcher?: (object: any, context: any, info: GraphQLResolveInfo) => string,
): GraphQLFieldConfig<any, any>;
4 changes: 2 additions & 2 deletions src/node/node.js
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ type GraphQLNodeDefinitions<TContext> = {
*/
export function nodeDefinitions<TContext>(
idFetcher: (id: string, context: TContext, info: GraphQLResolveInfo) => any,
typeResolver?: ?GraphQLTypeResolver<any, TContext>,
typeResolver?: GraphQLTypeResolver<any, TContext>,
): GraphQLNodeDefinitions<TContext> {
const nodeInterface = new GraphQLInterfaceType({
name: 'Node',
@@ -110,7 +110,7 @@ export function fromGlobalId(globalId: string): ResolvedGlobalId {
* property on the object.
*/
export function globalIdField(
typeName?: ?string,
typeName?: string,
idFetcher?: (object: any, context: any, info: GraphQLResolveInfo) => string,
): GraphQLFieldConfig<any, mixed> {
return {
2 changes: 1 addition & 1 deletion src/node/plural.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ type PluralIdentifyingRootFieldConfig = {
context: any,
info: GraphQLResolveInfo,
) => ?any,
description?: ?string,
description?: string,
};

export function pluralIdentifyingRootField(