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

Fix CacheOptions Related Types #267

Closed
HishamAli81 opened this issue Oct 10, 2023 · 1 comment · Fixed by #268
Closed

Fix CacheOptions Related Types #267

HishamAli81 opened this issue Oct 10, 2023 · 1 comment · Fixed by #268

Comments

@HishamAli81
Copy link
Contributor

Problem:

There are a couple issues with the CacheOptions related types.

First, the RequestOptions.cacheOptions function returns a Promise<CO | undefined>, whereas the RESTDataSource.cacheOptionsFor() and HttpCache.fetch() functions both accept a function that returns ValueOrPromise<CO | undefined>.

Second, there are a number of places where the CO cache option generics argument is being propagated through to RequestOptions and AugmentedRequest

HishamAli81 pushed a commit to HishamAli81/datasource-rest-GH-267 that referenced this issue Oct 10, 2023
* Fix RequestOptions.cacheOptions function return type to also return a non-promise value.
* Fix propagation of the cache options generic type `RequestOptions` and `AugmentedRequest`.
@HishamAli81
Copy link
Contributor Author

I've created this PR to fix some of the type issues: #268. It's a follow up to this PR: #185 that I created & was already merged.

HishamAli81 pushed a commit to HishamAli81/datasource-rest-GH-267 that referenced this issue Oct 17, 2023
Update generic args when calling policyRequestFrom()
trevor-scheer pushed a commit to HishamAli81/datasource-rest-GH-267 that referenced this issue Oct 17, 2023
* Fix RequestOptions.cacheOptions function return type to also return a non-promise value.
* Fix propagation of the cache options generic type `RequestOptions` and `AugmentedRequest`.
trevor-scheer pushed a commit to HishamAli81/datasource-rest-GH-267 that referenced this issue Oct 17, 2023
Update generic args when calling policyRequestFrom()
HishamAli81 pushed a commit to HishamAli81/datasource-rest-GH-267 that referenced this issue Oct 18, 2023
trevor-scheer pushed a commit that referenced this issue Oct 18, 2023
* Fix RequestOptions.cacheOptions function return type to also return a non-promise value.
* Fix propagation of the cache options generic type RequestOptions and AugmentedRequest.

Fixes #267
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant