/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ import {ArrayKeyType, ArrayKeyTypeData, KeyType, KeyTypeData} from '../ReactRelayTypes'; import { GraphQLTaggedNode } from 'relay-runtime'; // NOTE: These declares ensure that the type of the returned data is: // - non-nullable if the provided ref type is non-nullable // - nullable if the provided ref type is nullable // - array of non-nullable if the provided ref type is an array of // non-nullable refs // - array of nullable if the provided ref type is an array of nullable refs export function useFragment( fragmentInput: GraphQLTaggedNode, fragmentRef: TKey, ): KeyTypeData; export function useFragment( fragmentInput: GraphQLTaggedNode, fragmentRef: TKey | null | undefined, ): KeyTypeData | null | undefined; export function useFragment( fragmentInput: GraphQLTaggedNode, fragmentRef: TKey, ): ArrayKeyTypeData; export function useFragment( fragmentInput: GraphQLTaggedNode, fragmentRef: TKey | null | undefined, ): ArrayKeyTypeData | null | undefined;