Skip to content

Commit 0459f5c

Browse files
committed
fix: preserve js docs when directly passing options to betterAuth
1 parent 91209b1 commit 0459f5c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/better-auth/src/auth.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ import { getEndpoints, router } from "./api";
22
import { init } from "./init";
33
import type { BetterAuthOptions } from "./types/options";
44
import type {
5-
InferErrorCodes,
65
InferPluginErrorCodes,
76
InferPluginTypes,
87
InferSession,
98
InferUser,
9+
PreserveJSDoc,
1010
PrettifyDeep,
1111
} from "./types";
1212
import { getBaseURL } from "./utils/url";
1313
import type { FilterActions, InferAPI } from "./types/api";
1414
import { BASE_ERROR_CODES } from "./error/codes";
1515

16-
export const betterAuth = <O extends BetterAuthOptions>(options: O) => {
16+
export const betterAuth = <O extends BetterAuthOptions>(
17+
options: PreserveJSDoc<O>,
18+
) => {
1719
const authContext = init(options);
1820
const { api } = getEndpoints(authContext, options);
1921
const errorCodes = options.plugins?.reduce((acc, plugin) => {

packages/better-auth/src/types/helper.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ export type LiteralNumber = 0 | (number & Record<never, never>);
66
export type OmitId<T extends { id: unknown }> = Omit<T, "id">;
77

88
export type Prettify<T> = Omit<T, never>;
9+
export type PreserveJSDoc<T> = {
10+
[K in keyof T]: T[K];
11+
} & {};
912
export type PrettifyDeep<T> = {
1013
[K in keyof T]: T[K] extends (...args: any[]) => any
1114
? T[K]

0 commit comments

Comments
 (0)