Skip to content

Commit

Permalink
fix: augment runtime config types
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed May 13, 2024
1 parent 8708141 commit d7783e7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ export interface ModuleOptions {
}
}

declare module '@nuxt/schema' {
interface RuntimeConfig {
apiParty: ModuleOptions
}
}

export default defineNuxtModule<ModuleOptions>({
meta: {
name: 'nuxt-api-party',
Expand Down Expand Up @@ -109,10 +115,8 @@ export default defineNuxtModule<ModuleOptions>({
logger.error('Missing API endpoints configuration. Please check the `apiParty` module configuration in `nuxt.config.ts`.')

// Private runtime config
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error, @typescript-eslint/ban-ts-comment
// @ts-ignore: `client` types are not compatible
nuxt.options.runtimeConfig.apiParty = defu(
nuxt.options.runtimeConfig.apiParty as Required<ModuleOptions>,
nuxt.options.runtimeConfig.apiParty,
options,
)

Expand Down

0 comments on commit d7783e7

Please sign in to comment.