diff --git a/packages/frameworks-solid-start/src/client.ts b/packages/frameworks-solid-start/src/client.ts index 000a12dc57..51f8b3db0d 100644 --- a/packages/frameworks-solid-start/src/client.ts +++ b/packages/frameworks-solid-start/src/client.ts @@ -1,14 +1,50 @@ -import type { - LiteralUnion, - SignInOptions, - SignInAuthorizationParams, - SignOutParams, -} from "next-auth/react" import type { BuiltInProviderType, + ProviderType, RedirectableProviderType, } from "@auth/core/providers" +/** + * Util type that matches some strings literally, but allows any other string as well. + * @source https://github.com/microsoft/TypeScript/issues/29729#issuecomment-832522611 + */ +export type LiteralUnion = + | T + | (U & Record) + +export interface ClientSafeProvider { + id: LiteralUnion + name: string + type: ProviderType + signinUrl: string + callbackUrl: string +} + +export interface SignInOptions extends Record { + /** + * Specify to which URL the user will be redirected after signing in. Defaults to the page URL the sign-in is initiated from. + * + * [Documentation](https://next-auth.js.org/getting-started/client#specifying-a-callbackurl) + */ + callbackUrl?: string + /** [Documentation](https://next-auth.js.org/getting-started/client#using-the-redirect-false-option) */ + redirect?: boolean +} + +/** Match `inputType` of `new URLSearchParams(inputType)` */ +export type SignInAuthorizationParams = + | string + | string[][] + | Record + | URLSearchParams + +export interface SignOutParams { + /** [Documentation](https://next-auth.js.org/getting-started/client#specifying-a-callbackurl-1) */ + callbackUrl?: string + /** [Documentation](https://next-auth.js.org/getting-started/client#using-the-redirect-false-option-1 */ + redirect?: R +} + /** * Client-side method to initiate a signin flow * or send the user to the signin page listing all possible providers.