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 bbd3958
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<any, TVariables> | SuspenseCellQueryResult
}

export type CellFailureProps<TVariables extends OperationVariables = any> = {
queryResult?: NonSuspenseCellQueryResult<TVariables> | SuspenseCellQueryResult
queryResult?: NonSuspenseCellQueryResult<any, TVariables> | 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<TData, TVariables> | SuspenseCellQueryResult
updating?: boolean
} & A.Compute<CellSuccessData<TData>> // pre-computing makes the types more readable on hover

Expand Down Expand Up @@ -198,9 +198,10 @@ export type SuspendingSuccessProps = React.PropsWithChildren<
}

export type NonSuspenseCellQueryResult<
TData = any,
TVariables extends OperationVariables = 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 bbd3958

Please sign in to comment.