atinux / nuxt-auth-utils

Add Authentication to Nuxt applications with secured & sealed cookies sessions.
MIT License
962 stars 90 forks source link

fix: UserSession secure type augmentation #181

Closed IsraelOrtuno closed 1 month ago

IsraelOrtuno commented 2 months ago

Seems like secure type (https://github.com/atinux/nuxt-auth-utils/blob/main/src/runtime/types/session.ts#L14) can't be augmented just like in #54. This PR extracts the secure property type to a separated interface SecureSessionData that allows augmentation/overriding the default typings.

This would allow to add better typing to the secure property:

// auth.d.ts
declare module '#auth-utils' {
  interface SecureSessionData {
    token: string
  }
}

export {}
atinux commented 1 month ago

Thank you, and you updated the readme too ❤️