react-i18next 11.15.3 → 11.15.6
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 +12 -0
- package/LICENSE +1 -1
- package/package.json +2 -2
- package/ts4.1/icu.macro.d.ts +1 -0
- package/ts4.1/index.d.ts +11 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
### 11.15.6
|
|
2
|
+
|
|
3
|
+
- fix error for typescript 4.6 [1453](https://github.com/i18next/react-i18next/pull/1463)
|
|
4
|
+
|
|
5
|
+
### 11.15.5
|
|
6
|
+
|
|
7
|
+
- types: fix never return type when using plurals [1453](https://github.com/i18next/react-i18next/pull/1453)
|
|
8
|
+
|
|
9
|
+
### 11.15.4
|
|
10
|
+
|
|
11
|
+
- types: add values field to Plural component in macros [1446](https://github.com/i18next/react-i18next/pull/1446)
|
|
12
|
+
|
|
1
13
|
### 11.15.3
|
|
2
14
|
|
|
3
15
|
- types: fix for issue introduced with type extension for react-native [1436](https://github.com/i18next/react-i18next/pull/1436)
|
package/LICENSE
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-i18next",
|
|
3
|
-
"version": "11.15.
|
|
3
|
+
"version": "11.15.6",
|
|
4
4
|
"description": "Internationalization for react done right. Using the i18next i18n ecosystem.",
|
|
5
5
|
"main": "dist/commonjs/index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"rollup-plugin-terser": "^5.1.1",
|
|
87
87
|
"sinon": "^7.2.3",
|
|
88
88
|
"tslint": "^5.20.1",
|
|
89
|
-
"typescript": "
|
|
89
|
+
"typescript": "4.6.2",
|
|
90
90
|
"yargs": "^13.3.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
package/ts4.1/icu.macro.d.ts
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
|
|
@@ -319,7 +327,7 @@ export function withTranslation<N extends Namespace = DefaultNamespace>(
|
|
|
319
327
|
withRef?: boolean;
|
|
320
328
|
},
|
|
321
329
|
): <
|
|
322
|
-
C extends React.ComponentType<React.ComponentProps<
|
|
330
|
+
C extends React.ComponentType<React.ComponentProps<any> & WithTranslationProps>,
|
|
323
331
|
ResolvedProps = JSX.LibraryManagedAttributes<
|
|
324
332
|
C,
|
|
325
333
|
Subtract<React.ComponentProps<C>, WithTranslationProps>
|