Skip to content

Commit 3869211

Browse files
Forbid null & undefined as return value of 'interfaces' thunk (#2951)
1 parent 1df295e commit 3869211

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/type/definition.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ export function argsToArgsConfig(
433433
export interface GraphQLObjectTypeConfig<TSource, TContext> {
434434
name: string;
435435
description?: Maybe<string>;
436-
interfaces?: Thunk<Maybe<Array<GraphQLInterfaceType>>>;
436+
interfaces?: Thunk<Array<GraphQLInterfaceType>>;
437437
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
438438
isTypeOf?: Maybe<GraphQLIsTypeOfFn<TSource, TContext>>;
439439
extensions?: Maybe<Readonly<GraphQLObjectTypeExtensions<TSource, TContext>>>;
@@ -635,7 +635,7 @@ export class GraphQLInterfaceType {
635635
export interface GraphQLInterfaceTypeConfig<TSource, TContext> {
636636
name: string;
637637
description?: Maybe<string>;
638-
interfaces?: Thunk<Maybe<Array<GraphQLInterfaceType>>>;
638+
interfaces?: Thunk<Array<GraphQLInterfaceType>>;
639639
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>;
640640
/**
641641
* Optionally provide a custom type resolver function. If one is not provided,

src/type/definition.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ function defineInterfaces(
772772
| GraphQLInterfaceTypeConfig<mixed, mixed>,
773773
>,
774774
): Array<GraphQLInterfaceType> {
775-
const interfaces = resolveThunk(config.interfaces) ?? [];
775+
const interfaces = resolveThunk(config.interfaces ?? []);
776776
devAssert(
777777
Array.isArray(interfaces),
778778
`${config.name} interfaces must be an Array or a function which returns an Array.`,
@@ -875,7 +875,7 @@ export function argsToArgsConfig(
875875
export type GraphQLObjectTypeConfig<TSource, TContext> = {|
876876
name: string,
877877
description?: ?string,
878-
interfaces?: Thunk<?Array<GraphQLInterfaceType>>,
878+
interfaces?: Thunk<Array<GraphQLInterfaceType>>,
879879
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
880880
isTypeOf?: ?GraphQLIsTypeOfFn<TSource, TContext>,
881881
extensions?: ?ReadOnlyObjMapLike<mixed>,
@@ -1086,7 +1086,7 @@ export class GraphQLInterfaceType {
10861086
export type GraphQLInterfaceTypeConfig<TSource, TContext> = {|
10871087
name: string,
10881088
description?: ?string,
1089-
interfaces?: Thunk<?Array<GraphQLInterfaceType>>,
1089+
interfaces?: Thunk<Array<GraphQLInterfaceType>>,
10901090
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext>>,
10911091
/**
10921092
* Optionally provide a custom type resolver function. If one is not provided,

0 commit comments

Comments
 (0)