refactor: remove unused generics (#4691)

This commit is contained in:
Alex Yang
2025-09-16 13:50:07 -07:00
committed by Bereket Engida
parent 5359f32778
commit ac199be467
2 changed files with 11 additions and 9 deletions
+6 -6
View File
@@ -152,10 +152,10 @@ To resolve this, you can:
}
}
export function getEndpoints<
C extends AuthContext,
Option extends BetterAuthOptions,
>(ctx: Promise<C> | C, options: Option) {
export function getEndpoints<Option extends BetterAuthOptions>(
ctx: Promise<AuthContext> | AuthContext,
options: Option,
) {
const pluginEndpoints = options.plugins?.reduce(
(acc, plugin) => {
return {
@@ -245,8 +245,8 @@ export function getEndpoints<
middlewares,
};
}
export const router = <C extends AuthContext, Option extends BetterAuthOptions>(
ctx: C,
export const router = <Option extends BetterAuthOptions>(
ctx: AuthContext,
options: Option,
) => {
const { api, middlewares } = getEndpoints(ctx, options);
+5 -3
View File
@@ -17,10 +17,12 @@ import { BetterAuthError } from "./error";
export type WithJsDoc<T, D> = Expand<T & D>;
export const betterAuth = <O extends BetterAuthOptions>(
options: O & Record<never, never>,
options: O &
// fixme(alex): do we need Record<never, never> here?
Record<never, never>,
) => {
const authContext = init(options as O);
const { api } = getEndpoints(authContext, options as O);
const authContext = init(options);
const { api } = getEndpoints(authContext, options);
const errorCodes = options.plugins?.reduce((acc, plugin) => {
if (plugin.$ERROR_CODES) {
return {