Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS] Include query parameters in typed Cell component props #11737

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/docs/tutorial/chapter2/routing-params.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ export const Success = ({ article, id, rand }) => {
```tsx
interface Props
extends CellSuccessProps<FindArticleQuery, FindArticleQueryVariables> {
id: number
rand: number
}

Expand Down
6 changes: 3 additions & 3 deletions packages/web/src/components/cell/cellTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type CellLoadingProps<TVariables extends OperationVariables = any> = {
queryResult?:
| NonSuspenseCellQueryResult<TVariables, any>
| SuspenseCellQueryResult
}
} & TVariables

export type CellFailureProps<TVariables extends OperationVariables = any> = {
queryResult?:
Expand All @@ -68,7 +68,7 @@ export type CellFailureProps<TVariables extends OperationVariables = any> = {
*/
errorCode?: string
updating?: boolean
}
} & TVariables

// aka guarantee that all properties in T exist
type Guaranteed<T> = {
Expand Down Expand Up @@ -114,7 +114,7 @@ export type CellSuccessProps<
| NonSuspenseCellQueryResult<TVariables, TData>
| SuspenseCellQueryResult
updating?: boolean
} & A.Compute<CellSuccessData<TData>> // pre-computing makes the types more readable on hover
} & TVariables & A.Compute<CellSuccessData<TData>> // pre-computing makes the types more readable on hover

/**
* A coarse type for the `data` prop returned by `useQuery`.
Expand Down
Loading