Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed typings of updateQuery's previousQueryResult to be potentially undefined #12276

Open
wants to merge 8 commits into
base: release-3.13
Choose a base branch
from
Open
Show file tree
Hide file tree
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
62 changes: 46 additions & 16 deletions .api-reports/api-report-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1732,8 +1732,8 @@ export class ObservableQuery<TData = any, TVariables extends OperationVariables
silentSetOptions(newOptions: Partial<WatchQueryOptions<TVariables, TData>>): void;
startPolling(pollInterval: number): void;
stopPolling(): void;
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: Unmasked<TData>, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => Unmasked<TData>): void;
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData, TVariables>): () => void;
updateQuery(mapFn: UpdateQueryMapFn<TData, TVariables>): void;
get variables(): TVariables | undefined;
}

Expand Down Expand Up @@ -2323,13 +2323,34 @@ class Stump extends Layer {
}

// @public (undocumented)
export type SubscribeToMoreOptions<TData = any, TSubscriptionVariables = OperationVariables, TSubscriptionData = TData> = {
export interface SubscribeToMoreFunction<TData, TVars extends OperationVariables = OperationVariables> {
// (undocumented)
<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVars>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData, TVars>): () => void;
}

// @public (undocumented)
export interface SubscribeToMoreOptions<TData = any, TSubscriptionVariables extends OperationVariables = OperationVariables, TSubscriptionData = TData, TVars extends OperationVariables = TSubscriptionVariables> {
// (undocumented)
context?: DefaultContext;
// (undocumented)
document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;
variables?: TSubscriptionVariables;
updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;
// (undocumented)
onError?: (error: Error) => void;
context?: DefaultContext;
};
// Warning: (ae-forgotten-export) The symbol "SubscribeToMoreUpdateQueryFn" needs to be exported by the entry point index.d.ts
//
// (undocumented)
updateQuery?: SubscribeToMoreUpdateQueryFn<TData, TVars, TSubscriptionVariables, TSubscriptionData>;
// (undocumented)
variables?: TSubscriptionVariables;
}

// @public (undocumented)
type SubscribeToMoreUpdateQueryFn<TData = any, TVars extends OperationVariables = OperationVariables, TSubscriptionVariables extends OperationVariables = TVars, TSubscriptionData = TData> = UpdateQueryMapFn<TData, TVars, {
subscriptionData: {
data: Unmasked<TSubscriptionData>;
};
subscriptionVariables: TSubscriptionVariables | undefined;
}>;

// @public (undocumented)
export interface SubscriptionOptions<TVariables = OperationVariables, TData = any> {
Expand Down Expand Up @@ -2427,12 +2448,22 @@ type UnwrapFragmentRefs<TData> = true extends IsAny<TData> ? TData : TData exten
type UpdateQueries<TData> = MutationOptions<TData, any, any>["updateQueries"];

// @public (undocumented)
type UpdateQueryFn<TData = any, TSubscriptionVariables = OperationVariables, TSubscriptionData = TData> = (previousQueryResult: Unmasked<TData>, options: {
subscriptionData: {
data: Unmasked<TSubscriptionData>;
};
variables?: TSubscriptionVariables;
}) => Unmasked<TData>;
export interface UpdateQueryFn<TData, TVars extends OperationVariables, TOptions = {}> {
// (undocumented)
(mapFn: UpdateQueryMapFn<TData, TVars, TOptions>): void;
}

// @public (undocumented)
export interface UpdateQueryMapFn<TData = any, TVars extends OperationVariables = OperationVariables, TOptions = {}> {
// (undocumented)
(previousQueryResult: (Partial<Unmasked<TData>> & {
complete?: undefined;
}) | (Unmasked<TData> & {
complete: Symbol;
}), options: TOptions & {
variables?: TVars;
}): Unmasked<TData> | undefined;
}

// @public (undocumented)
export interface UpdateQueryOptions<TVariables> {
Expand Down Expand Up @@ -2514,11 +2545,10 @@ interface WriteContext extends ReadMergeModifyContext {
// src/cache/inmemory/policies.ts:162:3 - (ae-forgotten-export) The symbol "KeySpecifier" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/policies.ts:162:3 - (ae-forgotten-export) The symbol "KeyArgsFunction" needs to be exported by the entry point index.d.ts
// src/cache/inmemory/types.ts:139:3 - (ae-forgotten-export) The symbol "KeyFieldsFunction" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:120:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:121:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:121:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:122:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:159:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:414:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:277:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
// src/link/http/selectHttpOptionsAndBody.ts:128:32 - (ae-forgotten-export) The symbol "HttpQueryOptions" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)
Expand Down
75 changes: 52 additions & 23 deletions .api-reports/api-report-react.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1435,8 +1435,9 @@ class ObservableQuery<TData = any, TVariables extends OperationVariables = Opera
startPolling(pollInterval: number): void;
stopPolling(): void;
// Warning: (ae-forgotten-export) The symbol "SubscribeToMoreOptions" needs to be exported by the entry point index.d.ts
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>): () => void;
updateQuery<TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: Unmasked<TData>, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => Unmasked<TData>): void;
subscribeToMore<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData, TVariables>): () => void;
// Warning: (ae-forgotten-export) The symbol "UpdateQueryMapFn" needs to be exported by the entry point index.d.ts
updateQuery(mapFn: UpdateQueryMapFn<TData, TVariables>): void;
get variables(): TVariables | undefined;
}

Expand All @@ -1453,8 +1454,10 @@ export interface ObservableQueryFields<TData, TVariables extends OperationVariab
reobserve: (newOptions?: Partial<WatchQueryOptions<TVariables, TData>>, newNetworkStatus?: NetworkStatus) => Promise<ApolloQueryResult<MaybeMasked<TData>>>;
startPolling: (pollInterval: number) => void;
stopPolling: () => void;
subscribeToMore: <TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVariables>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData>) => () => void;
updateQuery: <TVars extends OperationVariables = TVariables>(mapFn: (previousQueryResult: Unmasked<TData>, options: Pick<WatchQueryOptions<TVars, TData>, "variables">) => Unmasked<TData>) => void;
// Warning: (ae-forgotten-export) The symbol "SubscribeToMoreFunction" needs to be exported by the entry point index.d.ts
subscribeToMore: SubscribeToMoreFunction<TData, TVariables>;
// Warning: (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
updateQuery: UpdateQueryFn<TData, TVariables>;
variables: TVariables | undefined;
}

Expand Down Expand Up @@ -2094,16 +2097,34 @@ Item
type StoreValue = number | string | string[] | Reference | Reference[] | null | undefined | void | Object;

// @public (undocumented)
type SubscribeToMoreFunction<TData, TVariables extends OperationVariables> = ObservableQueryFields<TData, TVariables>["subscribeToMore"];
interface SubscribeToMoreFunction<TData, TVars extends OperationVariables = OperationVariables> {
// (undocumented)
<TSubscriptionData = TData, TSubscriptionVariables extends OperationVariables = TVars>(options: SubscribeToMoreOptions<TData, TSubscriptionVariables, TSubscriptionData, TVars>): () => void;
}

// @public (undocumented)
type SubscribeToMoreOptions<TData = any, TSubscriptionVariables = OperationVariables, TSubscriptionData = TData> = {
interface SubscribeToMoreOptions<TData = any, TSubscriptionVariables extends OperationVariables = OperationVariables, TSubscriptionData = TData, TVars extends OperationVariables = TSubscriptionVariables> {
// (undocumented)
context?: Context;
// (undocumented)
document: DocumentNode | TypedDocumentNode<TSubscriptionData, TSubscriptionVariables>;
variables?: TSubscriptionVariables;
updateQuery?: UpdateQueryFn<TData, TSubscriptionVariables, TSubscriptionData>;
// (undocumented)
onError?: (error: Error) => void;
context?: Context;
};
// Warning: (ae-forgotten-export) The symbol "SubscribeToMoreUpdateQueryFn" needs to be exported by the entry point index.d.ts
//
// (undocumented)
updateQuery?: SubscribeToMoreUpdateQueryFn<TData, TVars, TSubscriptionVariables, TSubscriptionData>;
// (undocumented)
variables?: TSubscriptionVariables;
}

// @public (undocumented)
type SubscribeToMoreUpdateQueryFn<TData = any, TVars extends OperationVariables = OperationVariables, TSubscriptionVariables extends OperationVariables = TVars, TSubscriptionData = TData> = UpdateQueryMapFn<TData, TVars, {
subscriptionData: {
data: Unmasked<TSubscriptionData>;
};
subscriptionVariables: TSubscriptionVariables | undefined;
}>;

// @public (undocumented)
export interface SubscriptionCurrentObservable {
Expand Down Expand Up @@ -2224,12 +2245,22 @@ type UnwrapFragmentRefs<TData> = true extends IsAny<TData> ? TData : TData exten
type UpdateQueries<TData> = MutationOptions<TData, any, any>["updateQueries"];

// @public (undocumented)
type UpdateQueryFn<TData = any, TSubscriptionVariables = OperationVariables, TSubscriptionData = TData> = (previousQueryResult: Unmasked<TData>, options: {
subscriptionData: {
data: Unmasked<TSubscriptionData>;
};
variables?: TSubscriptionVariables;
}) => Unmasked<TData>;
interface UpdateQueryFn<TData, TVars extends OperationVariables, TOptions = {}> {
// (undocumented)
(mapFn: UpdateQueryMapFn<TData, TVars, TOptions>): void;
}

// @public (undocumented)
interface UpdateQueryMapFn<TData = any, TVars extends OperationVariables = OperationVariables, TOptions = {}> {
// (undocumented)
(previousQueryResult: (Partial<Unmasked<TData>> & {
complete?: undefined;
}) | (Unmasked<TData> & {
complete: Symbol;
}), options: TOptions & {
variables?: TVars;
}): Unmasked<TData> | undefined;
}

// @public (undocumented)
interface UriFunction {
Expand Down Expand Up @@ -2526,17 +2557,15 @@ interface WatchQueryOptions<TVariables extends OperationVariables = OperationVar
// src/cache/core/types/common.ts:104:3 - (ae-forgotten-export) The symbol "ToReferenceFunction" needs to be exported by the entry point index.d.ts
// src/cache/core/types/common.ts:105:3 - (ae-forgotten-export) The symbol "StorageType" needs to be exported by the entry point index.d.ts
// src/core/LocalState.ts:46:5 - (ae-forgotten-export) The symbol "FragmentMap" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:120:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:121:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:121:5 - (ae-forgotten-export) The symbol "QueryManager" needs to be exported by the entry point index.d.ts
// src/core/ObservableQuery.ts:122:5 - (ae-forgotten-export) The symbol "QueryInfo" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:159:5 - (ae-forgotten-export) The symbol "MutationStoreValue" needs to be exported by the entry point index.d.ts
// src/core/QueryManager.ts:414:7 - (ae-forgotten-export) The symbol "UpdateQueries" needs to be exported by the entry point index.d.ts
// src/core/types.ts:175:3 - (ae-forgotten-export) The symbol "MutationQueryReducer" needs to be exported by the entry point index.d.ts
// src/core/types.ts:204:5 - (ae-forgotten-export) The symbol "Resolver" needs to be exported by the entry point index.d.ts
// src/core/watchQueryOptions.ts:277:2 - (ae-forgotten-export) The symbol "UpdateQueryFn" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:38:3 - (ae-forgotten-export) The symbol "SubscribeToMoreFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:54:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:78:4 - (ae-forgotten-export) The symbol "RefetchFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useLoadableQuery.ts:120:9 - (ae-forgotten-export) The symbol "ResetFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:51:3 - (ae-forgotten-export) The symbol "FetchMoreFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useBackgroundQuery.ts:75:4 - (ae-forgotten-export) The symbol "RefetchFunction" needs to be exported by the entry point index.d.ts
// src/react/hooks/useLoadableQuery.ts:117:9 - (ae-forgotten-export) The symbol "ResetFunction" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
Loading
Loading