You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Convert KyResponse to an interface for better extensibility
Current Behavior
Currently, KyResponse is defined as a type in the ky library. This makes it difficult to extend or modify the type when users need to add custom properties or methods.
Proposed Change
Convert KyResponse from a type to an interface. This change would allow users to extend the interface as needed without encountering type conflicts.
Problem Description
When trying to extend the KyResponse type, users encounter type errors. For example:
Subsequent property declarations must have the same type. Property 'response' must be of type 'KyResponse<T>', but here has type '{ json: <J = T>() => Promise<J>; } & Response & { data: T; }'.
Attempting to redefine KyResponse as an interface leads to a different error:
Convert KyResponse to an interface for better extensibility
Current Behavior
Currently,
KyResponse
is defined as a type in the ky library. This makes it difficult to extend or modify the type when users need to add custom properties or methods.Proposed Change
Convert
KyResponse
from a type to an interface. This change would allow users to extend the interface as needed without encountering type conflicts.Problem Description
When trying to extend the
KyResponse
type, users encounter type errors. For example:This results in the following error:
Attempting to redefine
KyResponse
as an interface leads to a different error:Error:
Proposed Solution
Change the definition of
KyResponse
from a type to an interface in the ky library:This change would allow users to extend the interface as needed:
Benefits
KyResponse
.Potential Drawbacks
KyResponse
is defined, which might require updates to documentation.Additional Context
This change would be particularly helpful for users who need to add custom error handling or data processing to their ky-based API calls.
The text was updated successfully, but these errors were encountered: