Skip to content

Commit

Permalink
fix(web) type NonSuspenseCellQueryResult...
Browse files Browse the repository at this point in the history
Pass through `TData`, instead of `any`
  • Loading branch information
richard-stafflink committed Sep 26, 2024
1 parent b05a9a5 commit f6b8f95
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/web/src/components/cell/cellTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ export type CellProps<
>

export type CellLoadingProps<TVariables extends OperationVariables = any> = {
queryResult?: NonSuspenseCellQueryResult<TVariables> | SuspenseCellQueryResult
queryResult?: NonSuspenseCellQueryResult<TVariables, any> | SuspenseCellQueryResult
}

export type CellFailureProps<TVariables extends OperationVariables = any> = {
queryResult?: NonSuspenseCellQueryResult<TVariables> | SuspenseCellQueryResult
queryResult?: NonSuspenseCellQueryResult<TVariables, any> | SuspenseCellQueryResult
error?: QueryOperationResult['error'] | Error // for tests and storybook

/**
Expand Down Expand Up @@ -106,7 +106,7 @@ export type CellSuccessProps<
TData = any,
TVariables extends OperationVariables = any,
> = {
queryResult?: NonSuspenseCellQueryResult<TVariables> | SuspenseCellQueryResult
queryResult?: NonSuspenseCellQueryResult<TVariables, TData> | SuspenseCellQueryResult
updating?: boolean
} & A.Compute<CellSuccessData<TData>> // pre-computing makes the types more readable on hover

Expand Down Expand Up @@ -199,8 +199,9 @@ export type SuspendingSuccessProps = React.PropsWithChildren<

export type NonSuspenseCellQueryResult<
TVariables extends OperationVariables = any,
TData = any,
> = Partial<
Omit<QueryOperationResult<any, TVariables>, 'loading' | 'error' | 'data'>
Omit<QueryOperationResult<TData, TVariables>, 'loading' | 'error' | 'data'>
>

// We call this queryResult in createCell, sadly a very overloaded term
Expand Down

0 comments on commit f6b8f95

Please sign in to comment.