Skip to content

Commit

Permalink
fix(types): export ModulePublicRuntimeConfig for module builder typ…
Browse files Browse the repository at this point in the history
…e generation (#738)
  • Loading branch information
BobbieGoede authored May 2, 2024
1 parent 9bd9f45 commit 949e556
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
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 }
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
}
}

0 comments on commit 949e556

Please sign in to comment.