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

Forbid null & undefined as return value of 'interfaces' thunk #2951

Merged
merged 1 commit into from Mar 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/type/definition.d.ts
Expand Up @@ -433,7 +433,7 @@ export function argsToArgsConfig(
export interface GraphQLObjectTypeConfig<TSource, TContext> {
name: string;
description?: Maybe<string>;
interfaces?: Thunk<Maybe<Array<GraphQLInterfaceType>>>;
interfaces?: Thunk<Array<GraphQLInterfaceType>>;
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
isTypeOf?: Maybe<GraphQLIsTypeOfFn<TSource, TContext>>;
extensions?: Maybe<Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>>;
Expand Down Expand Up @@ -635,7 +635,7 @@ export class GraphQLInterfaceType {
export interface GraphQLInterfaceTypeConfig<TSource, TContext> {
name: string;
description?: Maybe<string>;
interfaces?: Thunk<Maybe<Array<GraphQLInterfaceType>>>;
interfaces?: Thunk<Array<GraphQLInterfaceType>>;
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
/**
* Optionally provide a custom type resolver function. If one is not provided,
Expand Down
6 changes: 3 additions & 3 deletions src/type/definition.js
Expand Up @@ -772,7 +772,7 @@ function defineInterfaces(
| GraphQLInterfaceTypeConfig<mixed, mixed>,
>,
): Array<GraphQLInterfaceType> {
const interfaces = resolveThunk(config.interfaces) ?? [];
const interfaces = resolveThunk(config.interfaces ?? []);
devAssert(
Array.isArray(interfaces),
`${config.name} interfaces must be an Array or a function which returns an Array.`,
Expand Down Expand Up @@ -875,7 +875,7 @@ export function argsToArgsConfig(
export type GraphQLObjectTypeConfig<TSource, TContext> = {|
name: string,
description?: ?string,
interfaces?: Thunk<?Array<GraphQLInterfaceType>>,
interfaces?: Thunk<Array<GraphQLInterfaceType>>,
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
isTypeOf?: ?GraphQLIsTypeOfFn<TSource, TContext>,
extensions?: ?ReadOnlyObjMapLike<mixed>,
Expand Down Expand Up @@ -1086,7 +1086,7 @@ export class GraphQLInterfaceType {
export type GraphQLInterfaceTypeConfig<TSource, TContext> = {|
name: string,
description?: ?string,
interfaces?: Thunk<?Array<GraphQLInterfaceType>>,
interfaces?: Thunk<Array<GraphQLInterfaceType>>,
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
/**
* Optionally provide a custom type resolver function. If one is not provided,
Expand Down