i18next 26.0.7 → 26.0.8
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/dist/esm/package.json +1 -1
- package/index.d.ts +12 -3
- package/package.json +1 -1
package/dist/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"26.0.
|
|
1
|
+
{"type":"module","version":"26.0.8"}
|
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
|
-
*
|
|
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:
|
|
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.
|