diff --git a/src/index.ts b/src/index.ts index a6bfc9476f..bce254f808 100644 --- a/src/index.ts +++ b/src/index.ts @@ -147,6 +147,8 @@ export type { GraphQLAbstractType, GraphQLWrappingType, GraphQLNullableType, + GraphQLNullableInputType, + GraphQLNullableOutputType, GraphQLNamedType, GraphQLNamedInputType, GraphQLNamedOutputType, diff --git a/src/type/definition.ts b/src/type/definition.ts index d9192c723a..5b62ba7739 100644 --- a/src/type/definition.ts +++ b/src/type/definition.ts @@ -183,16 +183,16 @@ export function assertListType(type: unknown): GraphQLList { export function isNonNullType( type: GraphQLInputType, -): type is GraphQLNonNull; +): type is GraphQLNonNull; export function isNonNullType( type: GraphQLOutputType, -): type is GraphQLNonNull; +): type is GraphQLNonNull; export function isNonNullType( type: unknown, -): type is GraphQLNonNull; +): type is GraphQLNonNull; export function isNonNullType( type: unknown, -): type is GraphQLNonNull { +): type is GraphQLNonNull { return instanceOf(type, GraphQLNonNull); } @@ -206,17 +206,15 @@ export function assertNonNullType(type: unknown): GraphQLNonNull { /** * These types may be used as input types for arguments and directives. */ -export type GraphQLInputType = +export type GraphQLNullableInputType = | GraphQLScalarType | GraphQLEnumType | GraphQLInputObjectType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLEnumType - | GraphQLInputObjectType - | GraphQLList - >; + | GraphQLList; + +export type GraphQLInputType = + | GraphQLNullableInputType + | GraphQLNonNull; export function isInputType(type: unknown): type is GraphQLInputType { return ( @@ -237,21 +235,17 @@ export function assertInputType(type: unknown): GraphQLInputType { /** * These types may be used as output types as the result of fields. */ -export type GraphQLOutputType = +export type GraphQLNullableOutputType = | GraphQLScalarType | GraphQLObjectType | GraphQLInterfaceType | GraphQLUnionType | GraphQLEnumType - | GraphQLList - | GraphQLNonNull< - | GraphQLScalarType - | GraphQLObjectType - | GraphQLInterfaceType - | GraphQLUnionType - | GraphQLEnumType - | GraphQLList - >; + | GraphQLList; + +export type GraphQLOutputType = + | GraphQLNullableOutputType + | GraphQLNonNull; export function isOutputType(type: unknown): type is GraphQLOutputType { return ( diff --git a/src/type/index.ts b/src/type/index.ts index 270dd67d35..43b867f999 100644 --- a/src/type/index.ts +++ b/src/type/index.ts @@ -75,6 +75,8 @@ export type { GraphQLAbstractType, GraphQLWrappingType, GraphQLNullableType, + GraphQLNullableInputType, + GraphQLNullableOutputType, GraphQLNamedType, GraphQLNamedInputType, GraphQLNamedOutputType,