fix: allow custom body properties

This commit is contained in:
Bereket Engida
2025-01-23 10:01:13 +03:00
parent 779f8aa2c9
commit ab3255facf

View File

@@ -6,7 +6,6 @@ import type { Context, Endpoint } from "better-call";
import type {
HasRequiredKeys,
Prettify,
StripEmptyObjects,
UnionToIntersection,
} from "../types/helper";
import type {
@@ -76,27 +75,6 @@ export type InferCtx<
export type MergeRoutes<T> = UnionToIntersection<T>;
export type InferReturn<R, O extends ClientOptions> = R extends Record<
string,
any
>
? StripEmptyObjects<
{
user: R extends { user: any } ? InferUserFromClient<O> : never;
users: R extends { users: any[] } ? InferUserFromClient<O>[] : never;
session: R extends { session: any } ? InferSessionFromClient<O> : never;
sessions: R extends { sessions: any[] }
? InferSessionFromClient<O>[]
: never;
} & {
[key in Exclude<
keyof R,
"user" | "users" | "session" | "sessions"
>]: R[key];
}
>
: R;
export type InferRoute<API, COpts extends ClientOptions> = API extends Record<
string,
infer T
@@ -116,8 +94,8 @@ export type InferRoute<API, COpts extends ClientOptions> = API extends Record<
? C extends Context<any, any>
? <
FetchOptions extends BetterFetchOption<
C["body"],
C["query"],
C["body"] & Record<string, any>,
C["query"] & Record<string, any>,
C["params"]
>,
>(