Skip to content

Commit 4551ee0

Browse files
committed
Merge pull request DefinitelyTyped#5690 from SebastianCoetzee/master
Update mithril.d.ts
2 parents c8e89bf + 037e1e8 commit 4551ee0

File tree

1 file changed

+30
-18
lines changed

1 file changed

+30
-18
lines changed

mithril/mithril.d.ts

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,38 @@
88
interface MithrilStatic {
99
(selector: string, attributes: Object, children?: any): MithrilVirtualElement;
1010
(selector: string, children?: any): MithrilVirtualElement;
11-
prop<T>(value?: T): (value?: T) => T;
12-
prop<T>(promise: MithrilPromise<T>): MithrilPromiseProperty<T>;
11+
prop<T>(value?: T): (value?: T) => T;
12+
prop<T>(promise: MithrilPromise<T>): MithrilPromiseProperty<T>;
1313
withAttr(property: string, callback: (value: any) => void): (e: Event) => any;
1414
module(rootElement: Node, module: MithrilModule): void;
1515
trust(html: string): String;
1616
render(rootElement: Element, children?: any): void;
1717
render(rootElement: HTMLDocument, children?: any): void;
1818
redraw: MithrilRedraw;
19-
route(rootElement: Element, defaultRoute: string, routes: { [key: string]: MithrilModule }): void;
20-
route(rootElement: HTMLDocument, defaultRoute: string, routes: { [key: string]: MithrilModule }): void;
21-
route(path: string, params?: any, shouldReplaceHistory?: boolean): void;
22-
route(): string;
23-
route(element: Element, isInitialized: boolean): void;
19+
route: MithrilRoute;
2420
request(options: MithrilXHROptions): MithrilPromise<any>;
2521
deferred<T>(): MithrilDeferred<T>;
2622
sync<T>(promises: MithrilPromise<T>[]): MithrilPromise<T>;
2723
startComputation(): void;
2824
endComputation(): void;
2925
}
3026

27+
interface MithrilRoute {
28+
(rootElement: Element, defaultRoute: string, routes: { [key: string]: MithrilModule }): void;
29+
(rootElement: HTMLDocument, defaultRoute: string, routes: { [key: string]: MithrilModule }): void;
30+
(path: string, params?: any, shouldReplaceHistory?: boolean): void;
31+
(element: Element, isInitialized: boolean): void;
32+
(): string;
33+
mode: string;
34+
param: MithrilParam;
35+
buildQueryString(data: Object): string;
36+
parseQueryString(queryString: string): Object;
37+
}
38+
39+
interface MithrilParam {
40+
(param: string): string;
41+
}
42+
3143
interface MithrilRedraw {
3244
(): void;
3345
strategy: (value?: string) => string;
@@ -40,26 +52,26 @@ interface MithrilVirtualElement {
4052
}
4153

4254
interface MithrilModule {
43-
controller: Function;
44-
view: (controller?: any) => MithrilVirtualElement;
55+
controller: Function;
56+
view: (controller?: any) => MithrilVirtualElement;
4557
}
4658

4759
interface MithrilDeferred<T> {
48-
resolve(value?: T): void;
49-
reject(value?: any): void;
50-
promise: MithrilPromise<T>;
60+
resolve(value?: T): void;
61+
reject(value?: any): void;
62+
promise: MithrilPromise<T>;
5163
}
5264

5365
interface MithrilPromise<T> {
54-
(value?: T): T;
55-
then<R>(successCallback?: (value: T) => R, errorCallback?: (value: any) => any): MithrilPromise<R>;
56-
then<R>(successCallback?: (value: T) => MithrilPromise<R>, errorCallback?: (value: any) => any): MithrilPromise<R>;
66+
(value?: T): T;
67+
then<R>(successCallback?: (value: T) => R, errorCallback?: (value: any) => any): MithrilPromise<R>;
68+
then<R>(successCallback?: (value: T) => MithrilPromise<R>, errorCallback?: (value: any) => any): MithrilPromise<R>;
5769
}
5870

5971
interface MithrilPromiseProperty<T> extends MithrilPromise<T> {
60-
(): T;
61-
(value: T): T;
62-
toJSON(): T;
72+
(): T;
73+
(value: T): T;
74+
toJSON(): T;
6375
}
6476

6577
interface MithrilXHROptions {

0 commit comments

Comments
 (0)