Denoder / nuxt-module-alternatives

Alternative modules to use while waiting for Nuxt 3 Compatibility
MIT License
144 stars 14 forks source link

How to set custom User type #85

Closed steklopod closed 2 years ago

steklopod commented 2 years ago

I want to set my custom User type with typescript. I created types/index.d.ts. I did it like this

import { Auth as NuxtAuth } from '#auth/runtime'
import { User } from '~/api/auth/models/user'

declare module 'vue/types/vue' {
    interface Vue {
        $auth: NuxtAuth & { user: User }
    }
}

Is it the right way to do this? Is it a good idea to add info about this in the readme?

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

steklopod commented 2 years ago

Or maybe it’s a right way to do that?