Skip to content

Commit 27b83ee

Browse files
committed
fix: preserve js docs when directly passing options to betterAuth
1 parent ff0ddbe commit 27b83ee

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/better-auth/src/auth.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ import type {
66
InferPluginTypes,
77
InferSession,
88
InferUser,
9-
PreserveJSDoc,
109
PrettifyDeep,
1110
} from "./types";
1211
import { getBaseURL } from "./utils/url";
1312
import type { FilterActions, InferAPI } from "./types/api";
1413
import { BASE_ERROR_CODES } from "./error/codes";
1514

15+
export type WithJsDoc<T, D> = Expand<T & D>;
16+
1617
export const betterAuth = <O extends BetterAuthOptions>(
17-
options: PreserveJSDoc<O>,
18+
options: WithJsDoc<O, BetterAuthOptions>,
1819
) => {
19-
const authContext = init(options);
20-
const { api } = getEndpoints(authContext, options);
20+
const authContext = init(options as O);
21+
const { api } = getEndpoints(authContext, options as O);
2122
const errorCodes = options.plugins?.reduce((acc, plugin) => {
2223
if (plugin.$ERROR_CODES) {
2324
return {

0 commit comments

Comments
 (0)