Skip to content

Type Extension Problem in nuxt-auth-utils #422

@MauroGonzalez51

Description

@MauroGonzalez51

Problem

I'm having issues extending the types for user sessions in nuxt-auth-utils. Despite following TypeScript module declaration best practices, the custom types are not being recognized when using setUserSession.

Environment

  • Nuxt version: 3.17.4
  • nuxt-auth-utils version: 0.5.20
  • TypeScript version: 5.8.3
  • Project structure: Monorepo (using Moon), but the Nuxt app functions independently

The issue
When calling setUserSession(event, { ... }), TypeScript doesn't recognize my custom type definitions from my auth.d.ts file

What I've tried

  1. Created a auth.d.ts file

Image

  1. Tried adding explicit configuration for nuxt.config.ts

export default defineNuxtConfig({
typescript: {
shim: false,
typeCheck: true,
tsConfig: {
include: ['types/**/*.d.ts']
}
}
// rest of configuration
})

Workarounds tried

As a temporary workaround, I've had to use:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions