i18next 22.3.0 → 22.4.0
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 +43 -12
- package/package.json +1 -1
package/dist/esm/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"type":"module","version":"22.
|
|
1
|
+
{"type":"module","version":"22.4.0"}
|
package/index.d.ts
CHANGED
|
@@ -879,54 +879,68 @@ export type TFuncReturn<
|
|
|
879
879
|
: TDefaultResult;
|
|
880
880
|
|
|
881
881
|
export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = undefined> {
|
|
882
|
+
// just key without options etc...
|
|
882
883
|
<
|
|
883
|
-
TKeys extends TFuncKey<
|
|
884
|
+
TKeys extends TFuncKey<PassedNS, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
|
|
884
885
|
TDefaultResult extends DefaultTFuncReturn = string,
|
|
885
886
|
TInterpolationMap extends object = StringMap,
|
|
887
|
+
PassedNS extends Namespace = N extends string ? N : N extends unknown ? DefaultNamespace : N,
|
|
886
888
|
>(
|
|
887
889
|
key: TKeys | TKeys[],
|
|
888
|
-
): TFuncReturn<
|
|
890
|
+
): TFuncReturn<PassedNS, TKeys, TDefaultResult, TKPrefix>;
|
|
891
|
+
|
|
892
|
+
// with returnDetails: true, returnObjects: true
|
|
889
893
|
<
|
|
890
894
|
TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
|
|
891
895
|
TDefaultResult extends DefaultTFuncReturnWithObject = object,
|
|
892
896
|
TInterpolationMap extends object = StringMap,
|
|
893
897
|
>(
|
|
894
898
|
key: TKeys | TKeys[],
|
|
895
|
-
options
|
|
899
|
+
options: TOptions<TInterpolationMap> & { returnDetails: true; returnObjects: true },
|
|
896
900
|
): TFunctionDetailedResult<TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>>;
|
|
901
|
+
|
|
902
|
+
// with returnDetails: true
|
|
897
903
|
<
|
|
898
904
|
TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
|
|
899
905
|
TDefaultResult extends DefaultTFuncReturn = string,
|
|
900
906
|
TInterpolationMap extends object = StringMap,
|
|
901
907
|
>(
|
|
902
908
|
key: TKeys | TKeys[],
|
|
903
|
-
options
|
|
909
|
+
options: TOptions<TInterpolationMap> & { returnDetails: true },
|
|
904
910
|
): TFunctionDetailedResult<TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>>;
|
|
911
|
+
|
|
912
|
+
// with returnObjects: true
|
|
905
913
|
<
|
|
906
914
|
TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
|
|
907
915
|
TDefaultResult extends DefaultTFuncReturnWithObject = object,
|
|
908
916
|
TInterpolationMap extends object = StringMap,
|
|
909
917
|
>(
|
|
910
918
|
key: TKeys | TKeys[],
|
|
911
|
-
options
|
|
919
|
+
options: TOptions<TInterpolationMap> & { returnObjects: true },
|
|
912
920
|
): TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>;
|
|
921
|
+
|
|
922
|
+
// with passed ns prop in options
|
|
913
923
|
<
|
|
914
|
-
TKeys extends TFuncKey<
|
|
924
|
+
TKeys extends TFuncKey<PassedNS, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
|
|
915
925
|
TDefaultResult extends DefaultTFuncReturn = string,
|
|
916
926
|
TInterpolationMap extends object = StringMap,
|
|
927
|
+
PassedNS extends Namespace = N extends string ? N : N extends unknown ? DefaultNamespace : N,
|
|
917
928
|
>(
|
|
918
929
|
key: TKeys | TKeys[],
|
|
919
|
-
options
|
|
920
|
-
): TFuncReturn<
|
|
930
|
+
options: TOptions<TInterpolationMap> & { ns: PassedNS },
|
|
931
|
+
): TFuncReturn<PassedNS, TKeys, TDefaultResult, TKPrefix>;
|
|
932
|
+
|
|
933
|
+
// with options
|
|
921
934
|
<
|
|
922
|
-
TKeys extends TFuncKey<
|
|
935
|
+
TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
|
|
923
936
|
TDefaultResult extends DefaultTFuncReturn = string,
|
|
924
937
|
TInterpolationMap extends object = StringMap,
|
|
925
|
-
PassedNS extends Namespace = N extends null ? DefaultNamespace : N,
|
|
926
938
|
>(
|
|
927
939
|
key: TKeys | TKeys[],
|
|
928
|
-
options: TOptions<TInterpolationMap
|
|
929
|
-
): TFuncReturn<
|
|
940
|
+
options: TOptions<TInterpolationMap>,
|
|
941
|
+
): TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>;
|
|
942
|
+
|
|
943
|
+
// defaultValue
|
|
930
944
|
<
|
|
931
945
|
TKeys extends TFuncKey<N, TKPrefix> | TemplateStringsArray extends infer A ? A : never,
|
|
932
946
|
TDefaultResult extends DefaultTFuncReturn = string,
|
|
@@ -936,6 +950,23 @@ export interface TFunction<N extends Namespace = DefaultNamespace, TKPrefix = un
|
|
|
936
950
|
defaultValue?: string,
|
|
937
951
|
options?: TOptions<TInterpolationMap> | string,
|
|
938
952
|
): TFuncReturn<N, TKeys, TDefaultResult, TKPrefix>;
|
|
953
|
+
<
|
|
954
|
+
TDefaultResult extends DefaultTFuncReturn = string,
|
|
955
|
+
TInterpolationMap extends object = StringMap,
|
|
956
|
+
>(
|
|
957
|
+
key: string | string[],
|
|
958
|
+
defaultValue: string,
|
|
959
|
+
options?: TOptions<TInterpolationMap> | string,
|
|
960
|
+
): TFuncReturn<N, string, TDefaultResult, TKPrefix>;
|
|
961
|
+
|
|
962
|
+
// defaultValue via options
|
|
963
|
+
<
|
|
964
|
+
TDefaultResult extends DefaultTFuncReturn = string,
|
|
965
|
+
TInterpolationMap extends object = StringMap,
|
|
966
|
+
>(
|
|
967
|
+
key: string | string[],
|
|
968
|
+
options: TOptions<TInterpolationMap> & { defaultValue: string },
|
|
969
|
+
): TFuncReturn<N, string, TDefaultResult, TKPrefix>;
|
|
939
970
|
}
|
|
940
971
|
|
|
941
972
|
export interface Resource {
|