Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions packages/react-relay/ReactRelayTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,27 @@ export type LoadQueryOptions = Readonly<{

export type EnvironmentProviderOptions<T extends Record<string, unknown> = Record<string, unknown>> = T;

export type PreloadedQuery<
// eslint type alias suggestion is not equivalent to the interface since it's looing the generic type information `TQuery`, preventing type inference, eg on usePreloadedQuery
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface PreloadedQuery<
TQuery extends OperationType,
TEnvironmentProviderOptions = EnvironmentProviderOptions,
> = Readonly<{
kind: 'PreloadedQuery';
environment: IEnvironment;
environmentProviderOptions?: TEnvironmentProviderOptions | null | undefined;
fetchKey: string | number;
fetchPolicy: PreloadFetchPolicy;
networkCacheConfig?: CacheConfig | null | undefined;
id?: string | null | undefined;
name: string;
source?: Observable<GraphQLResponse> | null | undefined;
variables: VariablesOf<TQuery>;
dispose: DisposeFn;
isDisposed: boolean;
}>;
> extends
Readonly<{
kind: 'PreloadedQuery';
environment: IEnvironment;
environmentProviderOptions?: TEnvironmentProviderOptions | null | undefined;
fetchKey: string | number;
fetchPolicy: PreloadFetchPolicy;
networkCacheConfig?: CacheConfig | null | undefined;
id?: string | null | undefined;
name: string;
source?: Observable<GraphQLResponse> | null | undefined;
variables: VariablesOf<TQuery>;
dispose: DisposeFn;
isDisposed: boolean;
}>
{}

export type PreloadQueryStatus = Readonly<{
cacheConfig?: CacheConfig | null | undefined;
Expand Down