feat(typescript): make response property public and typed in pagination #9933
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Linear ticket: N/A (Customer request from Slack thread)
Implements a customer feature request to make the
responseproperty on paginated responses publicly accessible and properly typed. Previously, theresponseproperty was private and typed asunknown/any, preventing customers from accessing the full response object when using auto-pagination.Link to Devin run: https://app.devin.ai/sessions/a5cea20fb1604fb5ace37cb53b05a09d
Requested by: [email protected] (@tjb9dc)
Changes Made
RtoPageclass for response type (defaults tounknownfor backward compatibility)responseproperty fromprivate response: unknowntopublic response: RRinstead ofunknownPageableclass to correctly pass response type to parentPage<T, R>classas anycast inPageableconstructorTesting
Test output: The
paginationfixture test passed, confirming that:responseproperty is now public and properly typed with the response type (e.g.,Pageable<ListUsersPaginationResponse, User>)R = unknownparameterImportant Review Points
Backward Compatibility: The default generic parameter
R = unknownensures existing code usingPage<T>continues to work. Verify no breaking changes in other parts of the codebase.Generator Integration: The TypeScript generator already passes both type parameters when instantiating
Pageable(verified in seed output at lines likenew core.Pageable<SeedPagination.ListUsersPaginationResponse, SeedPagination.User>). Confirm this pattern is consistent across all pagination scenarios.Type Safety: The
responseproperty is now public. While this was explicitly requested, confirm this doesn't expose unintended implementation details or create security concerns.Test Coverage: Only the
paginationfixture was tested. Consider whether additional seed tests or real-world scenarios should be validated before merging.