Skip to content

Commit

Permalink
fix: correct typing
Browse files Browse the repository at this point in the history
  • Loading branch information
dargmuesli committed Oct 12, 2022
1 parent 3e2fc33 commit bde33f4
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion playground/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { State } from '../src/types'
import { State } from '../src/runtime/types'

declare module '#app' {
interface NuxtApp {
Expand Down
10 changes: 7 additions & 3 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
import webpack from 'webpack' // eslint-disable-line import/no-named-as-default

import { name, version } from '../package.json'
import { DEFAULTS, ModuleOptions } from './types'
import { DEFAULTS, ModuleOptions } from './runtime/types'

export default defineNuxtModule<ModuleOptions>({
meta: {
Expand Down Expand Up @@ -103,10 +103,14 @@ export default defineNuxtModule<ModuleOptions>({
// })

addTemplate({
filename: 'nuxtCookieControl.options.mjs',
filename: 'nuxtCookieControl.options.ts',
write: true,
getContents: () =>
`export default ${JSON.stringify(moduleOptions, null, 2)}`,
`import { ModuleOptions } from '../../src/runtime/types'\n\nexport default ${JSON.stringify(
moduleOptions,
null,
2
)} as ModuleOptions`,
})

if (isNuxt2()) {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/components/CookieControl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ import { computed, onBeforeMount, ref, watch } from 'vue'
import { useNuxtApp } from '#app'
import { I18n } from '../../types'
import { I18n } from '../types'
export interface Props {
locale?: string
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/ar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'قبول الكل',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/de.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Alle akzeptieren',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/en.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Accept all',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/es.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Aceptar todo',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/fr.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Tout accepter',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/hr.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Dozvoli sve',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/hu.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Összes elfogadása',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/it.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Accetta tutto',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/ja.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: '全て同意',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/nl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Accepteer alles',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/no.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Godta alle',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/pt.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Aceitar todos',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/ru.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Принять все',
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/locale/uk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { I18n } from '../../types'
import { I18n } from '../types'

export default {
acceptAll: 'Прийняти усі',
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { defineNuxtPlugin } from '#app'

import { State } from '../types'
import { State } from './types'

import moduleOptions from '#build/nuxtCookieControl.options.mjs'
import moduleOptions from '#build/nuxtCookieControl.options'

export default defineNuxtPlugin((nuxtApp) => {
const state: State = {
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts → src/runtime/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import en from './runtime/locale/en'
import en from './locale/en'

export interface Cookie {
async?: boolean
Expand Down

0 comments on commit bde33f4

Please sign in to comment.