Skip to content

Commit

Permalink
Merge pull request #4 from nrccua/E4E-30
Browse files Browse the repository at this point in the history
[E4E-30]: Fix a few more unknown => any
  • Loading branch information
TheCleric authored Nov 21, 2021
2 parents 2225f29 + 6bce871 commit 7a655df
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.0.10](https://github.com/nrccua/apollo-rest-utils/compare/1.0.9...1.0.10) (2021-11-21)


### Changes

* [E4E-30]: Fix a few more unknown => any ([be51ef0](https://github.com/nrccua/apollo-rest-utils/commit/be51ef09609061982e2c0b4c36cadf49e5e5f079))
* [E4E-30]: 1.0.9 ([f7beab7](https://github.com/nrccua/apollo-rest-utils/commit/f7beab79299838ef1d14d1cee5266e71702fa618))

### [1.0.9](https://github.com/nrccua/apollo-rest-utils/compare/1.0.8...1.0.9) (2021-11-21)


Expand Down
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> },
);
}
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@
"test:unit": "NODE_ENV=test jest --silent --coverage",
"update:version": "standard-version"
},
"version": "1.0.9"
"version": "1.0.10"
}

0 comments on commit 7a655df

Please sign in to comment.