NextAuth errors.ts issue

Has anyone else ran into this typescript issue with NextAuth's errors.ts file when running the build script? It's been brought up in NextAuth's github discussions, but no response from their team. I'm using the latest t3-app. Failed to compile. ./node_modules/next-auth/src/core/errors.ts:11:11 Type error: No overload matches this call. Overload 1 of 2, '(message?: string, options?: ErrorOptions): Error', gave the following error. Argument of type 'string | Error' is not assignable to parameter of type 'string'. Type 'Error' is not assignable to type 'string'. Overload 2 of 2, '(message?: string): Error', gave the following error. Argument of type 'string | Error' is not assignable to parameter of type 'string'. Type 'Error' is not assignable to type 'string'. 9 | constructor(error: Error | string) { 10 | // Support passing error or string
11 | super((error as Error)?.message ?? error)
| ^ 12 | this.name = "UnknownError" 13 | this.code = (error as any).code 14 | if (error instanceof Error) { error Command failed with exit code 1.
Solution:
If this helps anyone later, I figured out this problem came from my IDE incorrectly importing type Session from "next-auth/src" instead of "next-auth".
Jump to solution
1 Reply
Solution
jh973
jh97312mo ago
If this helps anyone later, I figured out this problem came from my IDE incorrectly importing type Session from "next-auth/src" instead of "next-auth".