@hyper-fetch/core 7.0.2 → 7.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -690,7 +690,7 @@ declare class Request<Response, Payload, QueryParams, LocalError, Endpoint exten
|
|
|
690
690
|
* @param payloadMapper
|
|
691
691
|
* @returns
|
|
692
692
|
*/
|
|
693
|
-
setPayloadMapper: <MappedPayload extends
|
|
693
|
+
setPayloadMapper: <MappedPayload extends any | Promise<any>>(payloadMapper: (data: Payload) => MappedPayload) => Request<Response, Payload, QueryParams, LocalError, Endpoint, Client, HasPayload, HasParams, HasQuery>;
|
|
694
694
|
/**
|
|
695
695
|
* Map request before it gets send to the server
|
|
696
696
|
* @param requestMapper mapper of the request
|
|
@@ -1778,7 +1778,24 @@ declare class Client$1<GlobalErrorType extends ClientErrorType = Error, Adapter
|
|
|
1778
1778
|
*
|
|
1779
1779
|
* @template Response Your response
|
|
1780
1780
|
*/
|
|
1781
|
-
createRequest: <RequestProperties extends RequestGenericType<ExtractAdapterQueryParamsType<Adapter>> = {}>(
|
|
1781
|
+
createRequest: <RequestProperties extends RequestGenericType<ExtractAdapterQueryParamsType<Adapter>> = {}>(
|
|
1782
|
+
/**
|
|
1783
|
+
* `createRequest` must be initialized twice(currying).
|
|
1784
|
+
*
|
|
1785
|
+
* ✅ Good:
|
|
1786
|
+
* ```ts
|
|
1787
|
+
* const request = createRequest<RequestProperties>()(params)
|
|
1788
|
+
* ```
|
|
1789
|
+
* ⛔ Bad:
|
|
1790
|
+
* ```ts
|
|
1791
|
+
* const request = createRequest<RequestProperties>(params)
|
|
1792
|
+
* ```
|
|
1793
|
+
*
|
|
1794
|
+
* We are using currying to achieve auto generated types for the endpoint string.
|
|
1795
|
+
*
|
|
1796
|
+
* This solution will be removed once https://github.com/microsoft/TypeScript/issues/10571 get resolved.
|
|
1797
|
+
*/
|
|
1798
|
+
_USE_DOUBLE_INITIALIZATION?: never) => <EndpointType extends ExtractAdapterEndpointType<Adapter>, AdapterOptions extends ExtractAdapterOptionsType<Adapter>, MethodType extends ExtractAdapterMethodType<Adapter>>(params: RequestOptionsType<EndpointType, AdapterOptions, MethodType>) => Request<TypeWithDefaults<RequestProperties, "response", undefined>, TypeWithDefaults<RequestProperties, "payload", undefined>, TypeWithDefaults<RequestProperties, "queryParams", ExtractAdapterDefaultQueryParamsType<Adapter>, never>, TypeWithDefaults<RequestProperties, "error", GlobalErrorType>, TypeWithDefaults<RequestProperties, "endpoint", EndpointType> extends string ? TypeWithDefaults<RequestProperties, "endpoint", EndpointType> : any, Client$1<GlobalErrorType, ExtractUnionAdapter<Adapter, {
|
|
1782
1799
|
method: MethodType;
|
|
1783
1800
|
options: AdapterOptions;
|
|
1784
1801
|
queryParams: TypeWithDefaults<RequestProperties, "queryParams", ExtractAdapterDefaultQueryParamsType<Adapter>, never>;
|