Skip to content

Commit

Permalink
fix(ts): forward credentials fields to authorize (#2683)
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 authored Sep 6, 2021
1 parent 419ffe7 commit 3b23cfe
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/providers/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ export type CredentialsProvider = <C extends Record<string, CredentialInput>>(

export type CredentialsProviderType = "Credentials"

export default function Credentials(
options: Partial<CredentialsConfig>
): CredentialsConfig {
type UserCredentialsConfig<C extends Record<string, CredentialInput>> = Partial<
Omit<CredentialsConfig<C>, "options">
> &
Pick<CredentialsConfig<C>, "authorize" | "credentials">

export default function Credentials<
C extends Record<string, CredentialInput> = Record<string, CredentialInput>
>(options: UserCredentialsConfig<C>): CredentialsConfig<C> {
return {
id: "credentials",
name: "Credentials",
type: "credentials",
credentials: {} as any,
authorize: () => null,
options,
} as any
}
}

0 comments on commit 3b23cfe

Please sign in to comment.