-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
index.d.ts
53 lines (42 loc) · 1.21 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
type Engine = {
needkey: boolean;
fetch: (options: {
key: string;
from: string;
to: string;
text: string;
}) => [string, { [key: string]: any }];
parse: (res: { [key: string]: any }) => string;
};
type Options = string | { from?: string; to?: string };
declare const translate: {
(text: string, opts?: Options): Promise<string>;
key?: string;
engine?: "google" | "deepl" | "libre" | "yandex";
// More advanced types when tweaking the library
keys?: { [name: string]: string };
cache?: number;
engines?: { [name: string]: Engine };
Translate({}: {
from?: string;
to?: string;
key?: string;
engine?: "google" | "deepl" | "libre" | "yandex";
// More advanced types when tweaking the library
keys?: { [name: string]: string };
cache?: number;
engines?: { [name: string]: Engine };
}): typeof translate;
};
declare const Translate: ({}: {
from?: string;
to?: string;
key?: string;
engine?: "google" | "deepl" | "libre" | "yandex";
// More advanced types when tweaking the library
keys?: { [name: string]: string };
cache?: number;
engines?: { [name: string]: Engine };
}) => typeof translate;
export default translate;
export { Translate };