Skip to content

enh(#988,#1031,#585): improve module augmentation - #1101

Open
phoenix-ru wants to merge 2 commits into
mainfrom
enh/improve-module-augmentation
Open

phoenix-ru wants to merge 2 commits into
mainfrom
enh/improve-module-augmentation

Conversation

@phoenix-ru

@phoenix-ru phoenix-ru commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

🔗 Linked issue

Closes #988
Closes #1031
Closes #585

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR improves the documentation around module augmentation for both providers. The documentation around it was also tested and weak/incorrect points were patched.

❗ Breaking change disclaimer

There is a small breaking change in this PR - the default value of session.dataType: { id: 'string | number' } has been replaced by an empty object {} after researching the actual usages of this option. Most projects define their own session.dataType, and lots of them overwrite id. The ones which omit id or dataType entirely most of the time do not rely on id being available. If they do, this will be a breaking change for them. The expected impact is incredibly low, however, so it does not warrant a major release.

You are impacted if you have either of these configs:

// No explicit session data type.
auth: {
  provider: {
    type: 'local'
  }
}

// A session data type that does not explicitly declare `id`.
// This includes `dataType: {}`.
auth: {
  provider: {
    type: 'local',
    session: {
      dataType: {
        name: 'string',
        email: 'string'
      }
    }
  }
}

To migrate, explicitly declare id on dataType if you actually rely on it:

auth: {
  provider: {
    type: 'local',
    session: {
      dataType: {
        id: 'string | number'
        // Keep your other fields here.
      }
    }
  }
}

or use proper TypeScript module augmentation (recommended):

// auth.d.ts — included by your app's TypeScript project
declare module '#auth' {
  interface SessionData {
    id: string | number
  }
}

export {}

📝 Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

@pkg-pr-new

pkg-pr-new Bot commented Nov 6, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@sidebase/nuxt-auth@1101

commit: f84a301

@phoenix-ru phoenix-ru added the breaking-change A change will changes that require at least a minor release. label Nov 6, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change A change will changes that require at least a minor release.

Projects

None yet

1 participant