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

[PROPOSAL] Fix the type definitions #523

Open
sam-goodwin opened this issue May 21, 2023 · 1 comment
Open

[PROPOSAL] Fix the type definitions #523

sam-goodwin opened this issue May 21, 2023 · 1 comment

Comments

@sam-goodwin
Copy link

The type definitions in this library seem to not include the response type.

E.g. here is the index type definitions.

index<
    TResponse = Record<string, any>,
    TRequestBody extends RequestBody = Record<string, any>,
    TContext = Context
  >(
    params?: RequestParams.Index<TRequestBody>,
    options?: TransportRequestOptions
  ): TransportRequestPromise<ApiResponse<TResponse, TContext>>;

Why do I need to specify TResponse. I understand having to specify the TRequestBody to specify the type of the data i'm sending, but why doesn't the library automatically know that TResponse should be IndexResponse?

@wbeckler
Copy link

This makes sense and I see no logic to the current arrangement. Feel free to submit a PR if you want.

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

No branches or pull requests

2 participants