Home > Software design >  what is the type of i18next " t " variable (TYPESCRIPT)
what is the type of i18next " t " variable (TYPESCRIPT)

Time:05-15

I use i18next and I want to pass the t function prop to my interface.

exp:

const { t } = useTranslation();

export interface ITranslate {
   translate: ... type?
}

what is the type of the " t " variable ?

CodePudding user response:

You can use ReturnType utility type:

export interface ITranslate {
   translate: ReturnType<typeof useTranslation>['t']
}
  • Related