I set "declarations": true
in my tsconfig.json in order to have better autocomplete in my monorepo.
Now I get a few ts errors #2742, one example is in context of next-auth.
Code where I get the error:
import NextAuth from "next-auth";
import { authConfig } from "@my-monorepo/identity/auth/auth.config.js";
export const { handlers, auth } = NextAuth(authConfig);
The error I get:
The inferred type of 'auth' cannot be named without a reference to '../../../node_modules/next-auth/lib'. This is likely not portable. A type annotation is necessary.ts(2742)
Is there a way to fix this without manually redeclaring the exact type next-auth uses internally?