Comparing version 24.1.2 to 24.2.0
@@ -1,1 +0,1 @@ | ||
{"type":"module","version":"24.1.2"} | ||
{"type":"module","version":"24.2.0"} |
{ | ||
"name": "i18next", | ||
"version": "24.1.2", | ||
"version": "24.2.0", | ||
"description": "i18next internationalization framework", | ||
@@ -5,0 +5,0 @@ "main": "./dist/cjs/i18next.js", |
@@ -78,2 +78,8 @@ import type { $MergeBy, $PreservedValue, $Dictionary } from './helpers.js'; | ||
/** | ||
* Flag that enables strict key checking even if a `defaultValue` has been provided. | ||
* This ensures all calls of `t` function don't accidentally use implicitly missing keys. | ||
*/ | ||
strictKeyChecks: false; | ||
/** | ||
* Prefix for interpolation | ||
@@ -80,0 +86,0 @@ */ |
@@ -35,2 +35,3 @@ import type { | ||
type _UnescapeSuffix = TypeOptions['unescapeSuffix']; | ||
type _StrictKeyChecks = TypeOptions['strictKeyChecks']; | ||
@@ -282,3 +283,4 @@ type $IsResourcesDefined = [keyof _Resources] extends [never] ? false : true; | ||
************************* */ | ||
export interface TFunction<Ns extends Namespace = DefaultNamespace, KPrefix = undefined> { | ||
interface TFunctionStrict<Ns extends Namespace = DefaultNamespace, KPrefix = undefined> { | ||
$TFunctionBrand: $IsResourcesDefined extends true ? `${$FirstNamespace<Ns>}` : never; | ||
@@ -289,2 +291,23 @@ < | ||
Ret extends TFunctionReturn<Ns, AppendKeyPrefix<Key, KPrefix>, TOpt>, | ||
>( | ||
key: Key | Key[], | ||
options?: TOpt & InterpolationMap<Ret>, | ||
): TFunctionReturnOptionalDetails<TFunctionProcessReturnValue<$NoInfer<Ret>, never>, TOpt>; | ||
< | ||
const Key extends ParseKeys<Ns, TOpt, KPrefix> | TemplateStringsArray, | ||
const TOpt extends TOptions, | ||
Ret extends TFunctionReturn<Ns, AppendKeyPrefix<Key, KPrefix>, TOpt>, | ||
>( | ||
key: Key | Key[], | ||
defaultValue: string, | ||
options?: TOpt & InterpolationMap<Ret>, | ||
): TFunctionReturnOptionalDetails<TFunctionProcessReturnValue<$NoInfer<Ret>, never>, TOpt>; | ||
} | ||
interface TFunctionNonStrict<Ns extends Namespace = DefaultNamespace, KPrefix = undefined> { | ||
$TFunctionBrand: $IsResourcesDefined extends true ? `${$FirstNamespace<Ns>}` : never; | ||
< | ||
const Key extends ParseKeys<Ns, TOpt, KPrefix> | TemplateStringsArray, | ||
const TOpt extends TOptions, | ||
Ret extends TFunctionReturn<Ns, AppendKeyPrefix<Key, KPrefix>, TOpt>, | ||
const ActualOptions extends TOpt & InterpolationMap<Ret> = TOpt & InterpolationMap<Ret>, | ||
@@ -300,2 +323,7 @@ DefaultValue extends string = never, | ||
export type TFunction< | ||
Ns extends Namespace = DefaultNamespace, | ||
KPrefix = undefined, | ||
> = _StrictKeyChecks extends true ? TFunctionStrict<Ns, KPrefix> : TFunctionNonStrict<Ns, KPrefix>; | ||
export type KeyPrefix<Ns extends Namespace> = ResourceKeys<true>[$FirstNamespace<Ns>] | undefined; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
570219
12835