Skip to content

The inferred type of 'auth' cannot be named without a reference #9950

Closed Answered by yordis
yordis asked this question in Help
Discussion options

You must be logged in to vote

From @Falven, check #9950 (reply in thread)

One option is to explicitly re-type the destructed declarations.

import authOptions from './config/auth.config';
import NextAuth, { type NextAuthResult } from 'next-auth';

const result = NextAuth(authOptions);

export const handlers: NextAuthResult['handlers'] = result.handlers;
export const auth: NextAuthResult['auth'] = result.auth;
export const signIn: NextAuthResult['signIn'] = result.signIn;
export const signOut: NextAuthResult['signOut'] = result.signOut;

This avoids the naming issue because each property is typed individually and doesn't require a single stable type name for the entire object. But it's really up to next-auth to make thei…

Replies: 7 comments 18 replies

Comment options

You must be logged in to vote
8 replies
@yordis
Comment options

@xentobias
Comment options

@yordis
Comment options

@tszhong0411
Comment options

@xentobias
Comment options

Comment options

You must be logged in to vote
7 replies
@Falven
Comment options

@yordis
Comment options

@Falven
Comment options

@subvertallchris
Comment options

@MukeshAbhi
Comment options

Comment options

You must be logged in to vote
2 replies
@olivierlesnicki
Comment options

@theSaiRohit
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@DrewLandgraveCbsi
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by yordis
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet