Skip to content

Commit

Permalink
fix: ensure plugin is typed for $apollo and $apolloHelpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Diizzayy committed Mar 1, 2024
1 parent 4ac3665 commit 61d4b08
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": ["@nuxtjs/eslint-config-typescript"],
"rules": {
"no-redeclare": "off",
"import/named": "off",
"@typescript-eslint/no-unused-vars": "off",
"vue/multi-word-component-names": "off"
}
Expand Down
21 changes: 21 additions & 0 deletions src/runtime/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,24 @@ export default defineNuxtPlugin((nuxtApp) => {
}
}
})

interface DollarApolloHelpers extends ReturnType<typeof useApollo> {}
interface DollarApollo {
clients: Record<ApolloClientKeys, ApolloClient<any>>
defaultClient: ApolloClient<any>
}

declare module '#app' {
interface NuxtApp {
$apolloHelpers: DollarApolloHelpers
$apollo: DollarApollo
}
}

declare module 'vue' {
interface ComponentCustomProperties {
$apolloHelpers: DollarApolloHelpers
// @ts-ignore
$apollo: DollarApollo
}
}

0 comments on commit 61d4b08

Please sign in to comment.