Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import type { NuxtModule } from 'nuxt/schema'
import { getOriginAndPathnameFromURL, isProduction } from './runtime/helpers'
import type {
ModuleOptions,
ModuleOptionsNormalized,
SupportedAuthProviders,
AuthProviders
} from './runtime/types'
Expand Down Expand Up @@ -246,3 +247,16 @@ export default defineNuxtModule<ModuleOptions>({
logger.success('`nuxt-auth` setup done')
}
}) satisfies NuxtModule<ModuleOptions>

// Used by nuxt/module-builder for `types.d.ts` generation
export type { ModuleOptions }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, you can export the whole file of types export * from './runtime/types' and this would generate the entire module

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joaltoroc Thanks for your input, is there a strong reason why that is better?

export interface ModulePublicRuntimeConfig {
auth: ModuleOptionsNormalized
}

// Augment types for type inference in source code
declare module '@nuxt/schema' {
interface PublicRuntimeConfig {
auth: ModuleOptionsNormalized
}
}
7 changes: 0 additions & 7 deletions src/runtime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -514,10 +514,3 @@ export interface ModuleOptionsNormalized extends ModuleOptions {
fullBaseUrl: string
}
}

// Augment types
declare module 'nuxt/schema' {
interface PublicRuntimeConfig {
auth: ModuleOptionsNormalized
}
}