typeToExtKind function

Kind typeToExtKind(
  1. GraphQLType type
)

Returns the extension Kind for a given named GraphQLType

Implementation

Kind typeToExtKind(GraphQLType type) {
  return type.when(
    enum_: (type) => Kind.EnumTypeExtension,
    scalar: (type) => Kind.ScalarTypeExtension,
    object: (type) => type.isInterface
        ? Kind.InterfaceTypeExtension
        : Kind.ObjectTypeExtension,
    input: (type) => Kind.InputObjectTypeExtension,
    union: (type) => Kind.UnionTypeExtension,
    list: (type) => throw Error(),
    nonNullable: (type) => throw Error(),
  );

  // istanbul ignore next (Not reachable.
  // All possible types have been considered)
  // assert(false, 'Unexpected type: ' + inspect(type));
}