Skip to content

docs: Improve ExampleDataService types - #10001

Merged
FrederikBolding merged 3 commits into
mainfrom
fb/fix-base-data-service-example
Aug 28, 2026
Merged

docs: Improve ExampleDataService types#10001
FrederikBolding merged 3 commits into
mainfrom
fb/fix-base-data-service-example

Conversation

@FrederikBolding

@FrederikBolding FrederikBolding commented Aug 28, 2026

Copy link
Copy Markdown
Member

Explanation

ExampleDataService is not type checked, so we had missed some type inference issues. This PR fixes them.

References

N/A

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Test-only example service typing and pagination guards; no production runtime behavior change.

Overview
Updates ExampleDataService.getActivity so infinite-query types infer correctly once the example is type-checked.

fetchInfiniteQuery no longer passes an explicit GetActivityResponse generic; initialPageParam is null as PageParam so TPageParam lines up with getPreviousPageParam / getNextPageParam. Pagination branches use 'after' in pageParam and 'before' in pageParam instead of optional chaining on pageParam, with eslint disables where the project restricts that syntax.

Reviewed by Cursor Bugbot for commit f9f85dc. Bugbot is set up for automated code reviews on this repo. Configure here.

@FrederikBolding
FrederikBolding marked this pull request as ready for review August 28, 2026 09:04
@FrederikBolding
FrederikBolding requested a review from a team as a code owner August 28, 2026 09:04
@FrederikBolding
FrederikBolding deployed to default-branch August 28, 2026 09:04 — with GitHub Actions Active
{
queryKey: [`${this.name}:getActivity`, address],
initialPageParam: null,
initialPageParam: null as PageParam,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need a type cast here now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the simplest way to make the inference work without having to populate the many generic type parameters


if (pageParam?.after) {
// eslint-disable-next-line no-restricted-syntax
if (pageParam && 'after' in pageParam) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this use hasProperty?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately not, it doesn't seem to infer properly when the type is a union such as PageParam

@FrederikBolding
FrederikBolding requested a review from Mrtenz August 28, 2026 09:14
@FrederikBolding
FrederikBolding added this pull request to the merge queue Aug 28, 2026
Merged via the queue into main with commit 8e4c9ec Aug 28, 2026
125 checks passed
@FrederikBolding
FrederikBolding deleted the fb/fix-base-data-service-example branch August 28, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants