i18next 26.0.7 → 26.0.9

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.
package/README.md CHANGED
@@ -23,7 +23,7 @@ i18next provides:
23
23
  - Extensibility: eg. [sprintf](https://www.i18next.com/overview/plugins-and-utils#post-processors)
24
24
  - ...
25
25
 
26
- > **Pro Tip:** Looking for a way to manage your translations? Locize is the official service by i18next's creators and now offers a **[Free plan](https://www.locize.com/pricing)** for small projects.
26
+ > **Pro Tip:** Looking for a way to manage your translations? Locize is the official service by i18next's creators and now offers a **[Free plan](https://www.locize.com/pricing?utm_source=i18next_readme&utm_medium=github&utm_campaign=readme)** for small projects.
27
27
 
28
28
  For more information visit the website:
29
29
 
@@ -44,21 +44,21 @@ The react specific documentation is published on [react.i18next.com](https://rea
44
44
  <h3 align="center">Gold Sponsors</h3>
45
45
 
46
46
  <p align="center">
47
- <a href="https://locize.com/" target="_blank">
47
+ <a href="https://www.locize.com/?utm_source=i18next_readme&utm_medium=github&utm_campaign=readme" target="_blank">
48
48
  <img src="https://raw.githubusercontent.com/i18next/i18next/master/assets/locize_sponsor_240.gif" width="240px">
49
49
  </a>
50
50
  </p>
51
51
 
52
52
  ---
53
53
 
54
- **From the creators of i18next: localization as a service - [Locize](https://locize.com)**
54
+ **From the creators of i18next: localization as a service - [Locize](https://www.locize.com?utm_source=i18next_readme&utm_medium=github&utm_campaign=readme)**
55
55
 
56
- A translation management system built around the i18next ecosystem - [Locize](https://locize.com).
56
+ A translation management system built around the i18next ecosystem - [Locize](https://www.locize.com?utm_source=i18next_readme&utm_medium=github&utm_campaign=readme).
57
57
 
58
- **Now with a [Free plan](https://locize.com/pricing) for small projects!** Perfect for hobbyists or getting started.
58
+ **Now with a [Free plan](https://www.locize.com/pricing?utm_source=i18next_readme&utm_medium=github&utm_campaign=readme) for small projects!** Perfect for hobbyists or getting started.
59
59
 
60
60
  ![Locize](https://www.locize.com/img/ads/github_locize.png)
61
61
 
62
- With using [Locize](https://www.locize.com/?utm_source=i18next_readme&utm_medium=github) you directly support the future of i18next.
62
+ With using [Locize](https://www.locize.com/?utm_source=i18next_readme&utm_medium=github&utm_campaign=readme) you directly support the future of i18next.
63
63
 
64
64
  ---
@@ -1 +1 @@
1
- {"type":"module","version":"26.0.7"}
1
+ {"type":"module","version":"26.0.9"}
package/index.d.ts CHANGED
@@ -212,13 +212,17 @@ export type Callback = (error: any, t: TFunction) => void;
212
212
 
213
213
  /**
214
214
  * Uses similar args as the t function and returns true if a key exists.
215
- * Acts as a type guard, narrowing the key to {@link SelectorKey} so it can be passed to `t()`.
215
+ *
216
+ * Note: this shape intentionally does not include a type-guard overload so it
217
+ * remains easy to assign arrow functions to. The type guard narrowing to
218
+ * {@link SelectorKey} is declared directly on `i18n.exists` instead.
219
+ * Users who want narrowing on a custom wrapper can type it as
220
+ * `typeof i18next.exists`.
216
221
  */
217
222
  export interface ExistsFunction<
218
223
  TKeys extends string = string,
219
224
  TInterpolationMap extends object = $Dictionary,
220
225
  > {
221
- (key: TKeys, options?: TOptions<TInterpolationMap>): key is TKeys & SelectorKey;
222
226
  (key: TKeys | TKeys[], options?: TOptions<TInterpolationMap>): boolean;
223
227
  }
224
228
 
@@ -284,8 +288,13 @@ export interface i18n extends CustomInstanceExtensions {
284
288
 
285
289
  /**
286
290
  * Uses similar args as the t function and returns true if a key exists.
291
+ * Acts as a type guard on single-key calls, narrowing the key to
292
+ * {@link SelectorKey} so it can be passed to `t()`.
287
293
  */
288
- exists: ExistsFunction;
294
+ exists: {
295
+ <K extends string>(key: K, options?: TOptions): key is K & SelectorKey;
296
+ (key: string | string[], options?: TOptions): boolean;
297
+ };
289
298
 
290
299
  /**
291
300
  * Returns a resource data by language.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next",
3
- "version": "26.0.7",
3
+ "version": "26.0.9",
4
4
  "description": "i18next internationalization framework",
5
5
  "main": "./dist/cjs/i18next.js",
6
6
  "module": "./dist/esm/i18next.js",
@@ -122,7 +122,7 @@ export type TypeOptions = $MergeBy<
122
122
  * - `datetime` → `Date`
123
123
  * - `relativetime` → `number`
124
124
  * - `list` → `readonly string[]`
125
- * - No format specifier → `string`
125
+ * - No format specifier → `string | number` (since i18next stringifies values at runtime)
126
126
  *
127
127
  * Use this option to add mappings for custom formatters or to override
128
128
  * the built-in defaults.
package/typescript/t.d.ts CHANGED
@@ -196,7 +196,7 @@ type _StripFormatOptions<F> = F extends `${infer Name}(${string})` ? Name : F;
196
196
  type _ResolveEntryType<Name extends string, Format> = [Format] extends [never]
197
197
  ? Name extends 'count'
198
198
  ? number
199
- : string
199
+ : string | number
200
200
  : Format extends keyof _InterpolationFormatTypeMap
201
201
  ? _InterpolationFormatTypeMap[Format]
202
202
  : _StripFormatOptions<Format> extends keyof _InterpolationFormatTypeMap