Skip to content

Commit

Permalink
feat: Locale generic type for useI18n
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Sep 13, 2023
1 parent 9dc4869 commit 0065e58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export interface ModuleOptions {
*
* @default {}
*/
messages?: LocaleMessages
messages?: LocaleMessages<string>

/**
* Routes strategy
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/composables/useI18n.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { UseI18n } from '@byjohann/vue-i18n'
import type { I18nInstance } from '@byjohann/vue-i18n'
import { useNuxtApp } from '#imports'

export function useI18n() {
return useNuxtApp().$i18n as UseI18n
export function useI18n<const Locale extends string = string>() {
return useNuxtApp().$i18n as unknown as I18nInstance<Locale>
}

0 comments on commit 0065e58

Please sign in to comment.