Skip to content

Commit 61d4b08

Browse files
committed
fix: ensure plugin is typed for $apollo and $apolloHelpers
1 parent 4ac3665 commit 61d4b08

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.eslintrc

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"extends": ["@nuxtjs/eslint-config-typescript"],
33
"rules": {
44
"no-redeclare": "off",
5+
"import/named": "off",
56
"@typescript-eslint/no-unused-vars": "off",
67
"vue/multi-word-component-names": "off"
78
}

src/runtime/plugin.ts

+21
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,24 @@ export default defineNuxtPlugin((nuxtApp) => {
154154
}
155155
}
156156
})
157+
158+
interface DollarApolloHelpers extends ReturnType<typeof useApollo> {}
159+
interface DollarApollo {
160+
clients: Record<ApolloClientKeys, ApolloClient<any>>
161+
defaultClient: ApolloClient<any>
162+
}
163+
164+
declare module '#app' {
165+
interface NuxtApp {
166+
$apolloHelpers: DollarApolloHelpers
167+
$apollo: DollarApollo
168+
}
169+
}
170+
171+
declare module 'vue' {
172+
interface ComponentCustomProperties {
173+
$apolloHelpers: DollarApolloHelpers
174+
// @ts-ignore
175+
$apollo: DollarApollo
176+
}
177+
}

0 commit comments

Comments
 (0)