Skip to content

Commit

Permalink
Improved useTranslationClient type
Browse files Browse the repository at this point in the history
  • Loading branch information
silversonicaxel committed Sep 11, 2024
1 parent 9ed4448 commit bd54a10
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/helpers/hooks/useTranslationClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { renderHook } from '@testing-library/react'
import { changeLanguage, t } from 'i18next'
import { expect, test, describe } from 'vitest'

import type { UseTranslationClientParams } from './useTranslationClient'
import { useTranslationClient } from './useTranslationClient'


describe('Helpers > Hooks > useTranslationClient', () => {
const languageData = { locale: 'en', namespace: 'common' }
const languageData: UseTranslationClientParams = { locale: 'en', namespace: 'common' }

test('return expected resolved language', () => {
const { result } = renderHook(() => useTranslationClient(languageData))
Expand Down
5 changes: 3 additions & 2 deletions src/helpers/hooks/useTranslationClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import { useCookies } from 'react-cookie'
import { initReactI18next, useTranslation } from 'react-i18next'

import { getOptions, locales, I18N_COOKIE_NAME } from 'src/helpers/config/i18n'
import { I18nLocale } from 'src/types/i18n'


type UseTranslationClientParams = {
export type UseTranslationClientParams = {
/* eslint-disable @typescript-eslint/no-explicit-any */
locale: string
locale: I18nLocale
namespace: string
options?: { keyPrefix?: any }
/* eslint-enable */
Expand Down

0 comments on commit bd54a10

Please sign in to comment.