Skip to content

Commit

Permalink
fix(nextjs): Improve type inference for the return type of auth helper
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Nov 6, 2023
1 parent 7f7b4cb commit f084a63
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/new-eels-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/backend': patch
'@clerk/nextjs': patch
---

Fix type inferance for auth helper.
2 changes: 1 addition & 1 deletion packages/backend/src/tokens/authObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export function sanitizeAuthObject<T extends Record<any, any>>(authObject: T): T
*/
export const makeAuthObjectSerializable = <T extends Record<string, unknown>>(obj: T): T => {
// remove any non-serializable props from the returned object
// eslint-disable-next-line @typescript-eslint/no-unused-vars

const { debug, getToken, ...rest } = obj as unknown as AuthObject;
return rest as unknown as T;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/src/server/getAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const createGetAuth = ({
return (
req: RequestLike,
opts?: GetAuthOpts,
): AuthObjectWithoutResources<SignedInAuthObject | SignedOutAuthObject> => {
): AuthObjectWithoutResources<SignedInAuthObject> | AuthObjectWithoutResources<SignedOutAuthObject> => {
const debug = getHeader(req, constants.Headers.EnableDebug) === 'true';
if (debug) {
logger.enable();
Expand Down

0 comments on commit f084a63

Please sign in to comment.