i18next 22.0.2 → 22.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"type":"module","version":"22.0.2"}
1
+ {"type":"module","version":"22.0.3"}
package/index.d.ts CHANGED
@@ -824,7 +824,7 @@ type TypeOptionsFallback<TranslationValue, Option, MatchingValue> = Option exten
824
824
  /**
825
825
  * Checks if user has enabled `returnEmptyString` and `returnNull` options to retrieve correct values.
826
826
  */
827
- interface CustomTypeParameters {
827
+ interface CustomTypeParameters {
828
828
  returnNull?: boolean;
829
829
  returnEmptyString?: boolean;
830
830
  }
@@ -860,13 +860,9 @@ type NormalizeMultiReturn<T, V> = V extends `${infer N}:${infer R}`
860
860
  : never
861
861
  : never;
862
862
 
863
- export type DefaultTFuncReturn =
864
- | string
865
- | object
866
- | TFunctionDetailedResult
867
- | Array<string | object>
868
- | undefined
869
- | null;
863
+ export type DefaultTFuncReturn = string | undefined | null;
864
+
865
+ export type DefaultTFuncReturnWithObject = DefaultTFuncReturn | object | Array<string | object>;
870
866
 
871
867
  export type TFuncReturn<
872
868
  N,
@@ -892,7 +888,7 @@ export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = un
892
888
  ): TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>;
893
889
  <
894
890
  TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
895
- TDefaultResult extends DefaultTFuncReturn = object,
891
+ TDefaultResult extends DefaultTFuncReturnWithObject = object,
896
892
  TInterpolationMap extends object = StringMap,
897
893
  >(
898
894
  key: TKeys | TKeys[],
@@ -908,7 +904,7 @@ export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = un
908
904
  ): TFunctionDetailedResult<TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>>;
909
905
  <
910
906
  TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
911
- TDefaultResult extends DefaultTFuncReturn = object,
907
+ TDefaultResult extends DefaultTFuncReturnWithObject = object,
912
908
  TInterpolationMap extends object = StringMap,
913
909
  >(
914
910
  key: TKeys | TKeys[],
@@ -1184,12 +1180,20 @@ export interface i18n {
1184
1180
  *
1185
1181
  * Accepts optional keyPrefix that will be automatically applied to returned t function.
1186
1182
  */
1187
- getFixedT(
1183
+ getFixedT<N extends Namespace = DefaultNamespace, TKPrefix extends KeyPrefix<N> = undefined>(
1188
1184
  lng: string | readonly string[],
1189
- ns?: string | readonly string[],
1190
- keyPrefix?: string,
1191
- ): TFunction;
1192
- getFixedT(lng: null, ns: string | readonly string[] | null, keyPrefix?: string): TFunction;
1185
+ ns?: N,
1186
+ keyPrefix?: TKPrefix,
1187
+ ): TFunction<N, TKPrefix>;
1188
+ getFixedT<
1189
+ N extends Namespace | null,
1190
+ TKPrefix extends KeyPrefix<ActualNS>,
1191
+ ActualNS extends Namespace = N extends null ? DefaultNamespace : N,
1192
+ >(
1193
+ lng: null,
1194
+ ns: N,
1195
+ keyPrefix?: TKPrefix,
1196
+ ): TFunction<ActualNS, TKPrefix>;
1193
1197
 
1194
1198
  /**
1195
1199
  * Changes the language. The callback will be called as soon translations were loaded or an error occurs while loading.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next",
3
- "version": "22.0.2",
3
+ "version": "22.0.3",
4
4
  "description": "i18next internationalization framework",
5
5
  "main": "./dist/cjs/i18next.js",
6
6
  "module": "./dist/esm/i18next.js",