mirror of
https://github.com/better-auth/better-auth.git
synced 2026-07-30 17:12:35 -05:00
refactor: remove unused generics (#4691)
This commit is contained in:
committed by
Bereket Engida
parent
5359f32778
commit
ac199be467
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user