@@ -57,32 +57,31 @@ const getCurrentLocale = ({
5757interface Context {
5858 currentLocale : string
5959 dateFnsLocale ?: Locale ,
60- datetime ? : ( date : Date | number , options ?: Intl . DateTimeFormatOptions ) => string ,
61- formatDate ? : ( value : Date | number | string , options : FormatDateOptions ) => string ,
62- formatList ? : ( listFormat : [ string | undefined ] , options ?: Intl . ListFormatOptions ) => string ,
63- formatNumber ? : ( numb : number , options ?: Intl . NumberFormatOptions ) => string ,
64- formatUnit ? : ( value : number , options : FormatUnitOptions ) => string ,
65- loadTranslations ? : ( namespace : string , load ?: LoadTranslationsFn ) => Promise < string > ,
66- locales ? : string [ ] ,
67- namespaces ? : string [ ] ,
68- namespaceTranslation ? : ( namespace : string , t ?: TranslateFn ) => TranslateFn
69- relativeTime ? : ( date : Date | number , options ?: {
60+ datetime : ( date : Date | number , options ?: Intl . DateTimeFormatOptions ) => string ,
61+ formatDate : ( value : Date | number | string , options : FormatDateOptions ) => string ,
62+ formatList : ( listFormat : string [ ] , options ?: Intl . ListFormatOptions ) => string ,
63+ formatNumber : ( numb : number , options ?: Intl . NumberFormatOptions ) => string ,
64+ formatUnit : ( value : number , options : FormatUnitOptions ) => string ,
65+ loadTranslations : ( namespace : string , load ?: LoadTranslationsFn ) => Promise < string > ,
66+ locales : string [ ] ,
67+ namespaces : string [ ] ,
68+ namespaceTranslation : ( namespace : string , t ?: TranslateFn ) => TranslateFn
69+ relativeTime : ( date : Date | number , options ?: {
7070 includeSeconds ?: boolean ;
7171 addSuffix ?: boolean ;
7272 } ) => string ,
73- relativeTimeStrict ? : ( date : Date | number , options ?: {
73+ relativeTimeStrict : ( date : Date | number , options ?: {
7474 addSuffix ?: boolean ;
7575 unit ?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' ;
7676 roundingMethod ?: 'floor' | 'ceil' | 'round' ;
7777 } ) => string ,
78- setTranslations ? : React . Dispatch < React . SetStateAction < TranslationsByLocales > > ,
79- switchLocale ? : ( locale : string ) => void ,
80- t ? : TranslateFn ,
81- translations ? : TranslationsByLocales ,
78+ setTranslations : React . Dispatch < React . SetStateAction < TranslationsByLocales > > ,
79+ switchLocale : ( locale : string ) => void ,
80+ t : TranslateFn ,
81+ translations : TranslationsByLocales ,
8282}
8383
84- // @ts -expect-error we force the context to undefined, should be corrected with default values
85- const I18nContext = createContext < Context > ( undefined )
84+ const I18nContext = createContext < Context | undefined > ( undefined )
8685
8786export const useI18n = ( ) : Context => {
8887 const context = useContext ( I18nContext )
@@ -214,7 +213,7 @@ const I18nContextProvider = ({
214213 )
215214
216215 const formatList = useCallback (
217- ( listFormat : [ string | undefined ] , options ?: Intl . ListFormatOptions ) =>
216+ ( listFormat : string [ ] , options ?: Intl . ListFormatOptions ) =>
218217 formatters . getListFormat ( currentLocale , options ) . format ( listFormat ) ,
219218 [ currentLocale ] ,
220219 )
0 commit comments