i18next 25.10.1 → 25.10.2

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":"25.10.1"}
1
+ {"type":"module","version":"25.10.2"}
package/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import * as i18nextMod from './index.js';
2
2
  import type { $Dictionary } from './typescript/helpers.js';
3
3
 
4
4
  import type { DefaultNamespace, Namespace } from './typescript/options.js';
5
- import type { SelectorKey } from './typescript/t.js';
5
+ import type { KeyFromSelectorFn } from './typescript/t.js';
6
6
 
7
7
  export type WithT<Ns extends Namespace = DefaultNamespace> = i18nextMod.WithT<Ns>;
8
8
  export type Interpolator = i18nextMod.Interpolator;
@@ -59,6 +59,4 @@ export const hasLoadedNamespace: i18n['hasLoadedNamespace'];
59
59
  export const loadNamespaces: i18n['loadNamespaces'];
60
60
  export const loadLanguages: i18n['loadLanguages'];
61
61
 
62
- export declare function keyFromSelector<S = Record<string, any>>(
63
- selector: ($: S) => any,
64
- ): SelectorKey;
62
+ export declare const keyFromSelector: KeyFromSelectorFn;
package/index.d.ts CHANGED
@@ -12,7 +12,7 @@ import type {
12
12
  ResourceLanguage,
13
13
  TOptions,
14
14
  } from './typescript/options.js';
15
- import type { KeyPrefix, TFunction, SelectorKey } from './typescript/t.js';
15
+ import type { KeyPrefix, TFunction, KeyFromSelectorFn } from './typescript/t.js';
16
16
 
17
17
  export interface WithT<Ns extends Namespace = DefaultNamespace> {
18
18
  // Expose parameterized t in the i18next interface hierarchy
@@ -583,6 +583,4 @@ export const hasLoadedNamespace: i18n['hasLoadedNamespace'];
583
583
  export const loadNamespaces: i18n['loadNamespaces'];
584
584
  export const loadLanguages: i18n['loadLanguages'];
585
585
 
586
- export declare function keyFromSelector<S = Record<string, any>>(
587
- selector: ($: S) => any,
588
- ): SelectorKey;
586
+ export declare const keyFromSelector: KeyFromSelectorFn;
package/jsr.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i18next/i18next",
3
- "version": "25.10.1",
3
+ "version": "25.10.2",
4
4
  "license": "MIT",
5
5
  "exports": "./src/index.js",
6
6
  "publish": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "i18next",
3
- "version": "25.10.1",
3
+ "version": "25.10.2",
4
4
  "description": "i18next internationalization framework",
5
5
  "main": "./dist/cjs/i18next.js",
6
6
  "module": "./dist/esm/i18next.js",
package/typescript/t.d.ts CHANGED
@@ -478,6 +478,21 @@ declare const $SelectorKeyBrand: unique symbol;
478
478
  * Can be passed directly to `t()` when the selector API is enabled.
479
479
  */
480
480
  export type SelectorKey = string & { readonly [$SelectorKeyBrand]: typeof $SelectorKeyBrand };
481
+
482
+ /**
483
+ * Type-safe signature for {@link keyFromSelector}.
484
+ * Constrains the selector callback against the default namespace's resources
485
+ * (same source that `t()` uses for selectors without explicit `ns`).
486
+ * When resources are not defined, accepts any selector.
487
+ */
488
+ export type KeyFromSelectorFn = <
489
+ Ns extends Namespace = DefaultNamespace,
490
+ KPrefix extends KeyPrefix<Ns> = undefined,
491
+ >(
492
+ selector: (src: Select<GetSource<Ns, KPrefix>, undefined>) => any,
493
+ opts?: { ns?: Ns; keyPrefix?: KPrefix },
494
+ ) => SelectorKey;
495
+
481
496
  /** Recursively strips the {@link PluralValue} brand from a type (handles nested objects for `returnObjects`). */
482
497
  type DeepUnwrapPlural<T> =
483
498
  T extends PluralValue<infer U>