@better-auth-ui/core
Version:
Authentication components and data utilities for [Better Auth](https://better-auth.com), available for React and Solid.
23 lines (22 loc) • 711 B
TypeScript
import { AuthPlugin } from './auth-plugin';
/**
* Creates a plugin factory and attaches its `id` as a static property so
* consumers (e.g. `useAuthPlugin`) can look it up without invoking the
* factory.
*
* @example
* ```ts
* export const themePlugin = createAuthPlugin(
* "theme",
* (options: ThemePluginOptions) => ({
* setTheme: options.setTheme,
* themes: options.themes ?? ["system", "light", "dark"]
* })
* )
* ```
*/
export declare function createAuthPlugin<const TId extends string, TArgs extends unknown[], TResult extends Omit<AuthPlugin, "id"> & object>(id: TId, factory: (...args: TArgs) => TResult): ((...args: TArgs) => TResult & {
id: TId;
}) & {
id: TId;
};