Skip to content

Commit

Permalink
fix: Change getToken parameter type to required (#5245)
Browse files Browse the repository at this point in the history
* changed getToken parameter type to required

* removed redundant nullish coalescing operator

Co-authored-by: Thang Vu <thvu@hey.com>
  • Loading branch information
JohnMarsden24 and ThangHuuVu committed Sep 2, 2022
1 parent 3b7c988 commit d3571e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/next-auth/src/jwt/index.ts
Expand Up @@ -66,7 +66,7 @@ export interface GetTokenParams<R extends boolean = false> {
* [Documentation](https://next-auth.js.org/tutorials/securing-pages-and-api-routes#using-gettoken)
*/
export async function getToken<R extends boolean = false>(
params?: GetTokenParams<R>
params: GetTokenParams<R>
): Promise<R extends true ? string : JWT | null> {
const {
req,
Expand All @@ -79,7 +79,7 @@ export async function getToken<R extends boolean = false>(
decode: _decode = decode,
logger = console,
secret = process.env.NEXTAUTH_SECRET,
} = params ?? {}
} = params

if (!req) throw new Error("Must pass `req` to JWT getToken()")

Expand Down

0 comments on commit d3571e0

Please sign in to comment.