mirror of
https://github.com/better-auth/better-auth.git
synced 2026-06-01 03:46:39 -05:00
fix: asResponse return type not correctly inferred on getSession
This commit is contained in:
@@ -5,7 +5,7 @@ import { getDate } from "../../utils/date";
|
||||
import { memoryAdapter, type MemoryDB } from "../../adapters/memory-adapter";
|
||||
|
||||
describe("session", async () => {
|
||||
const { client, testUser, sessionSetter, cookieSetter } =
|
||||
const { client, testUser, sessionSetter, cookieSetter, auth } =
|
||||
await getTestInstance();
|
||||
|
||||
it("should set cookies correctly on sign in", async () => {
|
||||
|
||||
@@ -32,16 +32,18 @@ export type InferSessionAPI<API> = API extends {
|
||||
E extends Endpoint
|
||||
? E["path"] extends "/get-session"
|
||||
? {
|
||||
getSession: ((context: {
|
||||
getSession: <R extends boolean>(context: {
|
||||
headers: Headers;
|
||||
query?: {
|
||||
disableCookieCache?: boolean;
|
||||
};
|
||||
asResponse?: boolean;
|
||||
}) => Promise<PrettifyDeep<Awaited<ReturnType<E>>>>) & {
|
||||
options: E["options"];
|
||||
path: E["path"];
|
||||
};
|
||||
asResponse?: R;
|
||||
}) => R extends true
|
||||
? Promise<Response>
|
||||
: Promise<PrettifyDeep<Awaited<ReturnType<E>>>> & {
|
||||
options: E["options"];
|
||||
path: E["path"];
|
||||
};
|
||||
}
|
||||
: never
|
||||
: never
|
||||
|
||||
Reference in New Issue
Block a user