The inferred type of 'authClient' cannot be named without a reference to [email protected]

Currently having an issue with undici:
The inferred type of 'authClient' cannot be named without a reference to '.pnpm/[email protected]/node_modules/undici-types'. This is likely not portable. A type annotation is necessary.
The inferred type of 'authClient' cannot be named without a reference to '.pnpm/[email protected]/node_modules/undici-types'. This is likely not portable. A type annotation is necessary.
My auth client:
export const authClient = createAuthClient({
baseURL: 'http://localhost:3000',
fetchOptions: {
onError: (ctx) => {
addToast({
title: 'Error',
description: ctx.error.message,
variant: 'solid',
color: 'danger',
});
},
},
plugins: [usernameClient()],
});
export const authClient = createAuthClient({
baseURL: 'http://localhost:3000',
fetchOptions: {
onError: (ctx) => {
addToast({
title: 'Error',
description: ctx.error.message,
variant: 'solid',
color: 'danger',
});
},
},
plugins: [usernameClient()],
});
My tsconfig:
{
"extends": "@repo/typescript-config/nextjs.json",
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"next-env.d.ts",
"next.config.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
{
"extends": "@repo/typescript-config/nextjs.json",
"compilerOptions": {
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": [
"next-env.d.ts",
"next.config.ts",
"**/*.ts",
"**/*.tsx",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
3 Replies
Reis
ReisOP2mo ago
I've also added "undici-types": "^7.5.0" to my package.json and the problem persists After adding to my dependencies instead of devDependencies it worked
"undici-types": "^7.5.0"
"undici-types": "^7.5.0"
bekacru
bekacru2mo ago
add lib: ["dom"] in your tsconfig
Matt
Matt2mo ago
I've got the same issue but with nanostores: TS2742: The inferred type of authClient cannot be named without a reference to .pnpm/[email protected]/node_modules/nanostores. This is likely not portable. A type annotation is necessary. I have "lib": ["DOM", "DOM.Iterable", "ES2022"], and strict set in my TS config. I'm on version 1.2.4 I also tried installing nanostores with no luck Ignore me, TS got stuck. Installing nanostores worked!

Did you find this page helpful?