i18next 22.1.4 → 22.2.0

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.1.4"}
1
+ {"type":"module","version":"22.2.0"}
package/index.d.ts CHANGED
@@ -87,7 +87,7 @@ export type TypeOptions = MergeBy<
87
87
  CustomTypeOptions
88
88
  >;
89
89
 
90
- export type PluginOptions = MergeBy<
90
+ export type PluginOptions<T> = MergeBy<
91
91
  {
92
92
  /**
93
93
  * Options for language detection - check documentation of plugin
@@ -99,7 +99,7 @@ export type PluginOptions = MergeBy<
99
99
  * Options for backend - check documentation of plugin
100
100
  * @default undefined
101
101
  */
102
- backend?: object;
102
+ backend?: T;
103
103
 
104
104
  /**
105
105
  * Options for cache layer - check documentation of plugin
@@ -306,7 +306,7 @@ export interface ReactOptions {
306
306
  unescape?(str: string): string;
307
307
  }
308
308
 
309
- export interface InitOptions extends PluginOptions {
309
+ export interface InitOptions<T = object> extends PluginOptions<T> {
310
310
  /**
311
311
  * Logs info level to console output. Helps finding issues with loading not working.
312
312
  * @default false
@@ -918,6 +918,15 @@ export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = un
918
918
  key: TKeys | TKeys[],
919
919
  options?: TOptions<TInterpolationMap>,
920
920
  ): TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>;
921
+ <
922
+ TKeys extends TFuncKey<PassedNS, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
923
+ TDefaultResult extends DefaultTFuncReturn = string,
924
+ TInterpolationMap extends object = StringMap,
925
+ PassedNS extends Namespace = N extends null ? DefaultNamespace : N,
926
+ >(
927
+ key: TKeys | TKeys[],
928
+ options: TOptions<TInterpolationMap> & { ns: PassedNS },
929
+ ): TFuncReturn<PassedNS, TKeys, TDefaultResult, TKPrefix>;
921
930
  <
922
931
  TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
923
932
  TDefaultResult extends DefaultTFuncReturn = string,
@@ -1140,7 +1149,7 @@ export interface i18n {
1140
1149
  * @param callback - will be called after all translations were loaded or with an error when failed (in case of using a backend).
1141
1150
  */
1142
1151
  init(callback?: Callback): Promise<TFunction>;
1143
- init(options: InitOptions, callback?: Callback): Promise<TFunction>;
1152
+ init<T>(options: InitOptions<T>, callback?: Callback): Promise<TFunction>;
1144
1153
 
1145
1154
  loadResources(callback?: (err: any) => void): void;
1146
1155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next",
3
- "version": "22.1.4",
3
+ "version": "22.2.0",
4
4
  "description": "i18next internationalization framework",
5
5
  "main": "./dist/cjs/i18next.js",
6
6
  "module": "./dist/esm/i18next.js",
@@ -75,7 +75,8 @@
75
75
  "gh-release": "6.0.4",
76
76
  "husky": "^7.0.2",
77
77
  "i18next-browser-languagedetector": "7.0.1",
78
- "i18next-http-backend": "^2.0.2",
78
+ "i18next-fs-backend": "2.1.0",
79
+ "i18next-http-backend": "2.1.0",
79
80
  "i18next-localstorage-cache": "1.1.1",
80
81
  "i18next-sprintf-postprocessor": "0.2.2",
81
82
  "karma": "6.4.1",