UnlyEd/ra-data-graphql-prisma

View on GitHub
src/utils/isList.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { IntrospectionNonNullTypeRef, IntrospectionTypeRef, TypeKind } from 'graphql';

const isList = (type: IntrospectionTypeRef): boolean => {
  if (type.kind === TypeKind.NON_NULL) {
    return isList((type as IntrospectionNonNullTypeRef).ofType!);
  }

  return type.kind === TypeKind.LIST;
};

export default isList;