Skip to content

Commit 3d82fce

Browse files
authored
fix: module types generation (#570)
* chore(deps): update `@nuxt/module-builder` * fix: module types generation
1 parent 67623b0 commit 3d82fce

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"ohash": "^1.1.3"
3939
},
4040
"devDependencies": {
41-
"@nuxt/module-builder": "^0.5.2",
41+
"@nuxt/module-builder": "^0.5.4",
4242
"@nuxt/schema": "^3.8.0",
4343
"@nuxt/ui": "^0.4.1",
4444
"@nuxtjs/eslint-config-typescript": "^12.1.0",

pnpm-lock.yaml

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/module.ts

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,26 @@ export default defineNuxtModule<NuxtApolloConfig<any>>({
189189

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

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

197-
// @ts-ignore
198-
public:{
199-
apollo: NuxtApolloConfig<any>
200-
}
201-
}
197+
export interface ModuleRuntimeConfig {
198+
apollo: NuxtApolloConfig<any>
199+
}
202200

203-
interface RuntimeNuxtHooks {
204-
'apollo:auth': (params: { client: string, token: Ref<string | null> }) => void
205-
'apollo:error': (error: ErrorResponse) => void
206-
}
201+
export interface ModulePublicRuntimeConfig {
202+
apollo: NuxtApolloConfig<any>
203+
}
204+
205+
declare module '#app' {
206+
interface RuntimeNuxtHooks extends RuntimeModuleHooks {}
207+
}
208+
209+
declare module '@nuxt/schema' {
210+
interface NuxtConfig { ['apollo']?: Partial<ModuleOptions> }
211+
interface NuxtOptions { ['apollo']?: ModuleOptions }
212+
interface RuntimeConfig extends ModuleRuntimeConfig {}
213+
interface PublicRuntimeConfig extends ModulePublicRuntimeConfig {}
207214
}

0 commit comments

Comments
 (0)