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

chore(deps): update dependency typescript to v4.8.3 (stale) #10041

Closed
wants to merge 7 commits into from
Closed
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
17 changes: 0 additions & 17 deletions docs/shared/query-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,6 @@ The default value is `false`.
</td>
</tr>

<tr>
<td>

###### `displayName`

`string`
</td>

<td>

The name of your component to be displayed in the React Developer Tools.

The default value is `Query`.

</td>
</tr>

<tr>
<td colspan="2">

Expand Down
56 changes: 28 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"zen-observable-ts": "^1.2.5"
},
"devDependencies": {
"@babel/parser": "7.19.0",
"@babel/parser": "7.19.1",
"@graphql-tools/schema": "8.5.0",
"@rollup/plugin-node-resolve": "11.2.1",
"@testing-library/react": "13.4.0",
Expand All @@ -115,7 +115,7 @@
"@types/lodash": "4.14.185",
"@types/node": "16.11.45",
"@types/node-fetch": "2.6.2",
"@types/react": "18.0.19",
"@types/react": "18.0.20",
"@types/react-dom": "18.0.6",
"@types/use-sync-external-store": "0.0.3",
"acorn": "8.7.1",
Expand All @@ -125,7 +125,7 @@
"fetch-mock": "9.11.0",
"glob": "8.0.3",
"graphql": "16.6.0",
"graphql-ws": "5.10.1",
"graphql-ws": "5.11.1",
"jest": "28.1.3",
"jest-environment-jsdom": "28.1.3",
"jest-junit": "14.0.1",
Expand All @@ -145,7 +145,7 @@
"ts-jest": "28.0.8",
"ts-node": "10.9.1",
"typedoc": "0.22.18",
"typescript": "4.7.4",
"typescript": "4.8.3",
"wait-for-observables": "1.0.3",
"web-streams-polyfill": "3.2.1",
"whatwg-fetch": "3.6.2"
Expand Down
3 changes: 2 additions & 1 deletion src/cache/inmemory/inMemoryCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { makeVar, forgetCache, recallCache } from './reactiveVars';
import { Policies } from './policies';
import { hasOwn, normalizeConfig, shouldCanonizeResults } from './helpers';
import { canonicalStringify } from './object-canon';
import { OperationVariables } from '../../core';

type BroadcastOptions = Pick<
Cache.BatchOptions<InMemoryCache>,
Expand Down Expand Up @@ -226,7 +227,7 @@ export class InMemoryCache extends ApolloCache<NormalizedCacheObject> {
}
}

public diff<TData, TVariables = any>(
public diff<TData, TVariables extends OperationVariables = any>(
options: Cache.DiffOptions<TData, TVariables>,
): Cache.DiffResult<TData> {
return this.storeReader.diffQueryAgainstStore({
Expand Down
10 changes: 5 additions & 5 deletions src/core/ApolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export class ApolloClient<TCacheShape> implements DataProxy {
* See [here](https://medium.com/apollo-stack/the-concepts-of-graphql-bc68bd819be3#.3mb0cbcmc) for
* a description of store reactivity.
*/
public watchQuery<T = any, TVariables = OperationVariables>(
public watchQuery<T = any, TVariables extends OperationVariables = OperationVariables>(
options: WatchQueryOptions<TVariables, T>,
): ObservableQuery<T, TVariables> {
if (this.defaultOptions.watchQuery) {
Expand Down Expand Up @@ -311,7 +311,7 @@ export class ApolloClient<TCacheShape> implements DataProxy {
* describe how this query should be treated e.g. whether it should hit the
* server at all or just resolve from the cache, etc.
*/
public query<T = any, TVariables = OperationVariables>(
public query<T = any, TVariables extends OperationVariables = OperationVariables>(
options: QueryOptions<TVariables, T>,
): Promise<ApolloQueryResult<T>> {
if (this.defaultOptions.query) {
Expand Down Expand Up @@ -342,8 +342,8 @@ export class ApolloClient<TCacheShape> implements DataProxy {
*/
public mutate<
TData = any,
TVariables = OperationVariables,
TContext = DefaultContext,
TVariables extends OperationVariables = OperationVariables,
TContext extends {} = DefaultContext,
TCache extends ApolloCache<any> = ApolloCache<any>
>(
options: MutationOptions<TData, TVariables, TContext>,
Expand All @@ -358,7 +358,7 @@ export class ApolloClient<TCacheShape> implements DataProxy {
* This subscribes to a graphql subscription according to the options specified and returns an
* {@link Observable} which either emits received data or an error.
*/
public subscribe<T = any, TVariables = OperationVariables>(
public subscribe<T = any, TVariables extends OperationVariables = OperationVariables>(
options: SubscriptionOptions<TVariables, T>,
): Observable<FetchResult<T>> {
return this.queryManager.startGraphQLSubscription<T>(options);
Expand Down
10 changes: 5 additions & 5 deletions src/core/ObservableQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ interface Last<TData, TVariables> {

export class ObservableQuery<
TData = any,
TVariables = OperationVariables
TVariables extends OperationVariables = OperationVariables
> extends Observable<ApolloQueryResult<TData>> {
public readonly options: WatchQueryOptions<TVariables, TData>;
public readonly queryId: string;
Expand Down Expand Up @@ -390,7 +390,7 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`);

public fetchMore<
TFetchData = TData,
TFetchVars = TVariables,
TFetchVars extends OperationVariables = TVariables,
>(fetchMoreOptions: FetchMoreQueryOptions<TFetchVars, TFetchData> & {
updateQuery?: (
previousQueryResult: TData,
Expand Down Expand Up @@ -501,7 +501,7 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`);
// and you can only do it by stopping the subscription and then subscribing again with new variables.
public subscribeToMore<
TSubscriptionData = TData,
TSubscriptionVariables = TVariables
TSubscriptionVariables extends OperationVariables = TVariables
>(
options: SubscribeToMoreOptions<
TData,
Expand Down Expand Up @@ -599,7 +599,7 @@ Did you mean to call refetch(variables) instead of refetch({ variables })?`);
}, NetworkStatus.setVariables);
}

public updateQuery<TVars = TVariables>(
public updateQuery<TVars extends OperationVariables = TVariables>(
mapFn: (
previousQueryResult: TData,
options: Pick<WatchQueryOptions<TVars, TData>, "variables">,
Expand Down Expand Up @@ -933,7 +933,7 @@ fixObservableSubclass(ObservableQuery);
// this.options.fetchPolicy is "cache-and-network" or "network-only". When
// this.options.fetchPolicy is any other policy ("cache-first", "cache-only",
// "standby", or "no-cache"), we call this.reobserve() as usual.
export function reobserveCacheFirst<TData, TVars>(
export function reobserveCacheFirst<TData, TVars extends OperationVariables>(
obsQuery: ObservableQuery<TData, TVars>,
) {
const { fetchPolicy, nextFetchPolicy } = obsQuery.options;
Expand Down
16 changes: 8 additions & 8 deletions src/core/QueryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export class QueryManager<TStore> {

public async mutate<
TData,
TVariables,
TContext,
TVariables extends OperationVariables,
TContext extends {},
TCache extends ApolloCache<any>
>({
mutation,
Expand Down Expand Up @@ -516,7 +516,7 @@ export class QueryManager<TStore> {
}, mutation.mutationId);
}

public fetchQuery<TData, TVars>(
public fetchQuery<TData, TVars extends OperationVariables>(
queryId: string,
options: WatchQueryOptions<TVars, TData>,
networkStatus?: NetworkStatus,
Expand Down Expand Up @@ -616,7 +616,7 @@ export class QueryManager<TStore> {
};
}

public watchQuery<T, TVariables = OperationVariables>(
public watchQuery<T, TVariables extends OperationVariables = OperationVariables>(
options: WatchQueryOptions<TVariables, T>,
): ObservableQuery<T, TVariables> {
// assign variable default values if supplied
Expand Down Expand Up @@ -650,7 +650,7 @@ export class QueryManager<TStore> {
return observable;
}

public query<TData, TVars = OperationVariables>(
public query<TData, TVars extends OperationVariables = OperationVariables>(
options: QueryOptions<TVars, TData>,
queryId = this.generateQueryId(),
): Promise<ApolloQueryResult<TData>> {
Expand Down Expand Up @@ -1025,7 +1025,7 @@ export class QueryManager<TStore> {
return observable;
}

private getResultsFromLink<TData, TVars>(
private getResultsFromLink<TData, TVars extends OperationVariables>(
queryInfo: QueryInfo,
cacheWriteBehavior: CacheWriteBehavior,
options: Pick<WatchQueryOptions<TVars, TData>,
Expand Down Expand Up @@ -1104,7 +1104,7 @@ export class QueryManager<TStore> {
);
}

public fetchQueryObservable<TData, TVars>(
public fetchQueryObservable<TData, TVars extends OperationVariables>(
queryId: string,
options: WatchQueryOptions<TVars, TData>,
// The initial networkStatus for this fetch, most often
Expand Down Expand Up @@ -1352,7 +1352,7 @@ export class QueryManager<TStore> {
return results;
}

private fetchQueryByPolicy<TData, TVars>(
private fetchQueryByPolicy<TData, TVars extends OperationVariables>(
queryInfo: QueryInfo,
{ query,
variables,
Expand Down
4 changes: 2 additions & 2 deletions src/core/watchQueryOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export interface QueryOptions<TVariables = OperationVariables, TData = any> {
/**
* Watched query options.
*/
export interface WatchQueryOptions<TVariables = OperationVariables, TData = any>
export interface WatchQueryOptions<TVariables extends OperationVariables = OperationVariables, TData = any>
extends Omit<QueryOptions<TVariables, TData>, 'fetchPolicy'> {
/**
* Specifies the {@link FetchPolicy} to be used for this query.
Expand Down Expand Up @@ -147,7 +147,7 @@ export interface WatchQueryOptions<TVariables = OperationVariables, TData = any>
refetchWritePolicy?: RefetchWritePolicy;
}

export interface NextFetchPolicyContext<TData, TVariables> {
export interface NextFetchPolicyContext<TData, TVariables extends OperationVariables> {
reason:
| "after-fetch"
| "variables-changed";
Expand Down
Loading