Skip to content

Commit

Permalink
fix: module types generation (#570)
Browse files Browse the repository at this point in the history
* chore(deps): update `@nuxt/module-builder`

* fix: module types generation
  • Loading branch information
BobbieGoede committed Nov 23, 2023
1 parent 67623b0 commit 3d82fce
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"ohash": "^1.1.3"
},
"devDependencies": {
"@nuxt/module-builder": "^0.5.2",
"@nuxt/module-builder": "^0.5.4",
"@nuxt/schema": "^3.8.0",
"@nuxt/ui": "^0.4.1",
"@nuxtjs/eslint-config-typescript": "^12.1.0",
Expand Down
17 changes: 11 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 20 additions & 13 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,26 @@ export default defineNuxtModule<NuxtApolloConfig<any>>({

export const defineApolloClient = (config: ClientConfig) => config

declare module '#app' {
interface RuntimeConfig {
// @ts-ignore
apollo: NuxtApolloConfig<any>
export interface RuntimeModuleHooks {
'apollo:auth': (params: { client: string, token: Ref<string | null> }) => void
'apollo:error': (error: ErrorResponse) => void
}

// @ts-ignore
public:{
apollo: NuxtApolloConfig<any>
}
}
export interface ModuleRuntimeConfig {
apollo: NuxtApolloConfig<any>
}

interface RuntimeNuxtHooks {
'apollo:auth': (params: { client: string, token: Ref<string | null> }) => void
'apollo:error': (error: ErrorResponse) => void
}
export interface ModulePublicRuntimeConfig {
apollo: NuxtApolloConfig<any>
}

declare module '#app' {
interface RuntimeNuxtHooks extends RuntimeModuleHooks {}
}

declare module '@nuxt/schema' {
interface NuxtConfig { ['apollo']?: Partial<ModuleOptions> }
interface NuxtOptions { ['apollo']?: ModuleOptions }
interface RuntimeConfig extends ModuleRuntimeConfig {}
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
}

1 comment on commit 3d82fce

@HaNdTriX
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems these changes break the nuxt config types: #576

Please sign in to comment.