Skip to content

Commit

Permalink
feat: typescript typings (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoaoPedroAS51 authored May 19, 2020
1 parent a7c61e2 commit 5c75f37
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
"Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>"
],
"main": "lib/module.js",
"types": "types/index.d.ts",
"files": [
"lib"
"lib",
"types/*.d.ts"
],
"scripts": {
"lint": "eslint --ext .js,.vue .",
Expand Down
33 changes: 33 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type Vue from 'vue'
import type { default as VueAnalytics, InstallOptions } from 'vue-analytics'
import './vuex'

declare module '@nuxt/vue-app' {
interface Context {
$ga: VueAnalytics
}
interface NuxtAppOptions {
$ga: VueAnalytics
}
}

// Nuxt 2.9+
declare module '@nuxt/types' {
interface Context {
$ga: VueAnalytics
}

interface NuxtAppOptions {
$ga: VueAnalytics
}

interface Configuration {
googleAnalytics?: InstallOptions
}
}

declare module 'vue/types/vue' {
interface Vue {
$ga: VueAnalytics
}
}
7 changes: 7 additions & 0 deletions types/vuex.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type VueAnalytics from 'vue-analytics'

declare module 'vuex' {
interface Store<S> {
$ga: VueAnalytics,
}
}

0 comments on commit 5c75f37

Please sign in to comment.