Skip to content

Commit 3ff23cf

Browse files
authored
enhance: More flexible fetch types to help with inheritance (#932)
1 parent 0d7655e commit 3ff23cf

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

packages/experimental/src/rest/types.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
import { Schema } from '@rest-hooks/normalizr';
22
import { EndpointInstance, FetchFunction } from '@rest-hooks/endpoint';
33

4-
export type RestFetch<
5-
P = any,
6-
B = RequestInit['body'] | Record<string, any>,
7-
R = any,
8-
> = (this: RestEndpoint, params?: P, body?: B, ...rest: any) => Promise<R>;
4+
export type RestFetch<P = any, B = any, R = any> = (
5+
this: RestEndpoint,
6+
params?: P,
7+
body?: B,
8+
...rest: any
9+
) => Promise<R>;
910

10-
export type FetchMutate<
11-
P = any,
12-
B = RequestInit['body'] | Record<string, any>,
13-
R = any,
14-
> = (this: RestEndpoint, params: P, body: B) => Promise<R>;
11+
// eslint-disable-next-line @typescript-eslint/ban-types
12+
export type FetchMutate<P = any, B = {}, R = any> = (
13+
this: RestEndpoint,
14+
params: P,
15+
body: B,
16+
) => Promise<R>;
1517

1618
export type FetchGet<P = any, R = any> = (
1719
this: RestEndpoint,

0 commit comments

Comments
 (0)