I bumped to this definition when I was browsing Next-auth.js type definition.
export declare function signIn<P extends RedirectableProviderType | undefined = undefined>(provider?: LiteralUnion<BuiltInProviderType>, options?: SignInOptions, authorizationParams?: SignInAuthorizationParams): Promise<P extends RedirectableProviderType ? SignInResponse | undefined : undefined>;
What does undefined = undefined
part of the definition mean?
P extends RedirectableProviderType | undefined = undefined
means that RedirectableProviderType
or undefined
types are allowed to be asserted when invoking signIn
(e.g. signIn<RedirectableProviderType>
), however when no assertion type is provided - P
will be defaulted to undefined
.
This can alternatively be viewed as P (extends RedirectableProviderType | undefined) = undefined