react-i18next 11.15.4 → 11.15.5
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/CHANGELOG.md +4 -0
- package/LICENSE +1 -1
- package/package.json +1 -1
- package/ts4.1/index.d.ts +10 -2
package/CHANGELOG.md
CHANGED
package/LICENSE
CHANGED
package/package.json
CHANGED
package/ts4.1/index.d.ts
CHANGED
|
@@ -95,8 +95,10 @@ declare module 'i18next' {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
type PluralSuffix = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other';
|
|
99
|
+
|
|
98
100
|
type WithOrWithoutPlural<K> = TypeOptions['jsonFormat'] extends 'v4'
|
|
99
|
-
? K extends `${infer B}_${
|
|
101
|
+
? K extends `${infer B}_${PluralSuffix}`
|
|
100
102
|
? B | K
|
|
101
103
|
: K
|
|
102
104
|
: K;
|
|
@@ -150,6 +152,12 @@ export type NormalizeByTypeOptions<
|
|
|
150
152
|
R = TypeOptionsFallback<TranslationValue, Options['returnEmptyString'], ''>
|
|
151
153
|
> = TypeOptionsFallback<R, Options['returnNull'], null>;
|
|
152
154
|
|
|
155
|
+
type StringIfPlural<T> = TypeOptions['jsonFormat'] extends 'v4'
|
|
156
|
+
? T extends `${string}_${PluralSuffix}`
|
|
157
|
+
? string
|
|
158
|
+
: never
|
|
159
|
+
: never;
|
|
160
|
+
|
|
153
161
|
type NormalizeReturn<
|
|
154
162
|
T,
|
|
155
163
|
V,
|
|
@@ -162,7 +170,7 @@ type NormalizeReturn<
|
|
|
162
170
|
? K extends keyof T
|
|
163
171
|
? NormalizeReturn<T[K], R>
|
|
164
172
|
: never
|
|
165
|
-
:
|
|
173
|
+
: StringIfPlural<keyof T>;
|
|
166
174
|
|
|
167
175
|
type NormalizeMultiReturn<T, V> = V extends `${infer N}:${infer R}`
|
|
168
176
|
? N extends keyof T
|