Skip to content

Commit

Permalink
fix(types): add generic result type to oncomplete param (#1350)
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkbjo committed Jun 19, 2023
1 parent 373d7c6 commit a069603
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions services/data/src/engine/types/Query.ts
Expand Up @@ -21,9 +21,9 @@ export interface ResolvedResourceQuery extends ResourceQuery {
export type Query = Record<string, ResourceQuery>
export type QueryResult = JsonMap

export interface QueryOptions {
export interface QueryOptions<TQueryResult = QueryResult> {
variables?: QueryVariables
onComplete?: (data: QueryResult) => void
onComplete?: (data: TQueryResult) => void
onError?: (error: FetchError) => void
lazy?: boolean
}
2 changes: 1 addition & 1 deletion services/data/src/react/hooks/useDataQuery.ts
Expand Up @@ -40,7 +40,7 @@ export const useDataQuery = <TQueryResult = QueryResult>(
onError: userOnError,
variables: initialVariables = {},
lazy: initialLazy = false,
}: QueryOptions = {}
}: QueryOptions<TQueryResult> = {}
): QueryRenderInput<TQueryResult> => {
const [staticQuery] = useStaticInput<Query>(query, {
warn: true,
Expand Down

0 comments on commit a069603

Please sign in to comment.