Skip to content

Commit

Permalink
Allow passing a generic type to the translate fn
Browse files Browse the repository at this point in the history
Resolves aralroca#483
  • Loading branch information
gurkerl83 committed Feb 1, 2021
1 parent f296168 commit b4ca6fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { ReactElement, ReactNode } from 'react'
import { ReactElement, ReactNode } from 'react';

import nextTranslate from './plugin'
import nextTranslate from './plugin';

export interface TranslationQuery {
[name: string]: string | number
}

export type Translate = (
export type Translate = <T = string>(
i18nKey: string | TemplateStringsArray,
query?: TranslationQuery | null,
options?: { returnObjects?: boolean; fallback?: string | string[] }
) => string
) => T

export interface I18n {
t: Translate
Expand Down

0 comments on commit b4ca6fb

Please sign in to comment.