Skip to content

Commit 7f641d7

Browse files
authored
Fixed typing file
1 parent 8d7d115 commit 7f641d7

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

typings/acode.d.ts

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
type Input = string;
2+
type Strings = string[];
13

2-
export default class acode {
4+
declare var acode: Acode;
5+
6+
interface Acode {
37
/**
48
* Define a module
59
* @param {string} name
@@ -15,7 +19,11 @@ export default class acode {
1519

1620
setLoadingMessage(message: string): void;
1721

18-
setPluginInit(id: string, initFunction: (baseUrl: string, $page: HTMLElement, options?: any) => Promise<void>, settings: any): void;
22+
setPluginInit(
23+
id: string,
24+
initFunction: (baseUrl: string, $page: HTMLElement, options?: any) => Promise<void>,
25+
settings?: any
26+
): void;
1927

2028
getPluginSettings(id: string): any;
2129

@@ -52,7 +60,7 @@ export default class acode {
5260

5361
loader(title: string, message: string, cancel: { timeout: number,callback: ()=>void }): void;
5462

55-
joinUrl(...args: string): string;
63+
joinUrl(...args: string[]): string;
5664

5765
addIcon(className: string, src: string): void;
5866

@@ -72,23 +80,41 @@ export default class acode {
7280

7381
select(
7482
title: string,
75-
options: string[string, string, string, boolean] | string,
83+
options: [string, string, string, boolean][] | string,
7684
opts?: {
7785
onCancel?: () => void;
7886
onHide?: () => void;
7987
hideOnSelect?: boolean;
8088
textTransform?: boolean;
8189
default?: string;
82-
} | rejectOnCancel: boolean
90+
} | boolean
8391
): Promise<any>;
8492

85-
type Input = string;
86-
87-
type Strings = string[];
88-
8993
multiPrompt(title: string, inputs: Array<Input | Input[]>, help: string): Promise<Strings>;
9094

91-
fileBrowser(mode: 'file' | 'folder' | 'both', info: string, doesOpenLast: boolean): Promise<import('.').SelectedFile>;
95+
fileBrowser(mode: 'file' | 'folder' | 'both', info: string, doesOpenLast: boolean): Promise<
96+
| {
97+
name: string;
98+
type: 'file';
99+
url: string;
100+
}
101+
| {
102+
list: {
103+
icon: string;
104+
isDirectory: boolean;
105+
isFile: boolean;
106+
mime: string;
107+
name: string;
108+
type: 'file' | 'folder';
109+
uri: string;
110+
url: string;
111+
}[];
112+
scroll: number;
113+
name: string;
114+
type: 'folder';
115+
url: string;
116+
}
117+
>;
92118

93-
toInternalUrl(url:string): Promise<url: string>;
119+
toInternalUrl(url: string): Promise<string>;
94120
}

0 commit comments

Comments
 (0)