Skip to content

Commit

Permalink
[E4E-30]: Fix a few more unknown => any
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCleric committed Nov 21, 2021
1 parent f7beab7 commit be51ef0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/useRestQuery/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ export function useRestMutation<
*` const uid = result.user.uid; // This is properly typed!`
*/
export function wrapRestMutation<TName extends string>() {
return <TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<unknown> = ApolloCache<unknown>>(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return <TData = unknown, TVariables = OperationVariables, TContext = DefaultContext, TCache extends ApolloCache<any> = ApolloCache<any>>(
mutation: DocumentNode | TypedDocumentNode<TData, TVariables>,
options: IEndpointOptions<TData, TVariables> & MutationHookOptions<TData, TVariables, TContext>,
): MutationTuple<NamedGQLResult<TName, TData>, TVariables | Input<TVariables>, TContext, TCache> =>
Expand Down Expand Up @@ -177,7 +178,8 @@ export function wrapRestQuery<TName extends string>() {

export function useRestClientQuery<TName extends string, TData, TVariables>(
options: IEndpointOptions<NamedGQLResult<TName, TData>, TVariables | Input<TVariables>> &
QueryOptions<TVariables, NamedGQLResult<TName, TData>> & { client: ApolloClient<unknown> },
// eslint-disable-next-line @typescript-eslint/no-explicit-any
QueryOptions<TVariables, NamedGQLResult<TName, TData>> & { client: ApolloClient<any> },
): Promise<ApolloQueryResult<NamedGQLResult<TName, TData>>> {
validateQueryAgainstEndpoint(options.query, options.endpoint);
const directives = (options.query.definitions[0] as OperationDefinitionNode).selectionSet.selections[0].directives as DirectiveNode[];
Expand Down Expand Up @@ -219,10 +221,12 @@ export function useRestClientQuery<TName extends string, TData, TVariables>(
*/
export function wrapRestClientQuery<TName extends string>() {
return <TData, TVariables>(
options: IEndpointOptions<TData, TVariables> & QueryOptions<TVariables, TData> & { client: ApolloClient<unknown> },
// eslint-disable-next-line @typescript-eslint/no-explicit-any
options: IEndpointOptions<TData, TVariables> & QueryOptions<TVariables, TData> & { client: ApolloClient<any> },
): Promise<ApolloQueryResult<NamedGQLResult<TName, TData>>> =>
useRestClientQuery(
options as unknown as IEndpointOptions<NamedGQLResult<TName, TData>, TVariables | Input<TVariables>> &
QueryOptions<TVariables, NamedGQLResult<TName, TData>> & { client: ApolloClient<unknown> },
// eslint-disable-next-line @typescript-eslint/no-explicit-any
QueryOptions<TVariables, NamedGQLResult<TName, TData>> & { client: ApolloClient<any> },
);
}

0 comments on commit be51ef0

Please sign in to comment.