mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-04 19:42:46 +08:00
i18next: Fix compile errors (#19205)
This commit is contained in:
@@ -435,21 +435,21 @@ interface CustomOptions {
|
||||
myVar: string;
|
||||
}
|
||||
|
||||
i18next.t<string, object, KeyList>("friend");
|
||||
i18next.t<string, object, KeyList>(["friend", "tree"]);
|
||||
i18next.t<string, CustomOptions, KeyList>("friend", { myVar: "someValue" });
|
||||
i18next.t<string, CustomOptions, KeyList>(["friend", "tree"], { myVar: "someValue" });
|
||||
i18next.t<string, CustomOptions>("friend", { myVar: "someValue" });
|
||||
i18next.t<string, CustomOptions>(["friend", "tree"], { myVar: "someValue" });
|
||||
i18next.t("friend");
|
||||
i18next.t(["friend", "tree"]);
|
||||
i18next.t("friend", { myVar: "someValue" });
|
||||
i18next.t(["friend", "tree"], { myVar: "someValue" });
|
||||
i18next.t("friend", { myVar: "someValue" });
|
||||
i18next.t(["friend", "tree"], { myVar: "someValue" });
|
||||
|
||||
const t1: i18next.TranslationFunction = (key: string, options: i18next.TranslationOptions) => "";
|
||||
const t2: i18next.TranslationFunction<{ value: string }> = (key: string, options: i18next.TranslationOptions) => ({ value: "asd" });
|
||||
const t3: i18next.TranslationFunction<string, CustomOptions> = (key: string | string[], options: i18next.TranslationOptions<CustomOptions>) => "";
|
||||
const t4: i18next.TranslationFunction<string, object, KeyList> = (key: KeyList | KeyList[], options: i18next.TranslationOptions) => "";
|
||||
|
||||
i18next.exists<boolean, object, KeyList>("friend");
|
||||
i18next.exists<boolean, object, KeyList>(["friend", "tree"]);
|
||||
i18next.exists<boolean, CustomOptions, KeyList>("friend", { myVar: "someValue" });
|
||||
i18next.exists<boolean, CustomOptions, KeyList>(["friend", "tree"], { myVar: "someValue" });
|
||||
i18next.exists<boolean, CustomOptions>("friend", { myVar: "someValue" });
|
||||
i18next.exists<boolean, CustomOptions>(["friend", "tree"], { myVar: "someValue" });
|
||||
i18next.exists("friend");
|
||||
i18next.exists(["friend", "tree"]);
|
||||
i18next.exists("friend", { myVar: "someValue" });
|
||||
i18next.exists(["friend", "tree"], { myVar: "someValue" });
|
||||
i18next.exists("friend", { myVar: "someValue" });
|
||||
i18next.exists(["friend", "tree"], { myVar: "someValue" });
|
||||
|
||||
3
types/i18next/index.d.ts
vendored
3
types/i18next/index.d.ts
vendored
@@ -396,8 +396,7 @@ declare namespace i18next {
|
||||
type Callback = (error: any, t: TranslationFunction) => void;
|
||||
|
||||
type TranslationFunction<TResult = any, TValues extends object = object, TKeys extends string = string> =
|
||||
<TMethodResult = TResult, TMethodValues extends object = TValues, TMethodKeys extends string = TKeys>
|
||||
(key: TMethodKeys | TMethodKeys[], options?: TranslationOptions<TMethodValues>) => TMethodResult;
|
||||
(key: TKeys | TKeys[], options?: TranslationOptions<TValues>) => TResult;
|
||||
|
||||
interface Resource {
|
||||
[language: string]: ResourceLanguage;
|
||||
|
||||
Reference in New Issue
Block a user