From 8e188ed9f200d3a4bd0b7dfdea8b90f0edbb75ab Mon Sep 17 00:00:00 2001 From: Joel Mueller Date: Sat, 24 Jan 2015 10:44:04 -0600 Subject: [PATCH] Improvements to m.prop, m.redraw.strategy. Makes m.prop() generic for better type inference, allows access to m.redraw.strategy, which was previously impossible. --- mithril/mithril.d.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mithril/mithril.d.ts b/mithril/mithril.d.ts index 39c9539f8e..faee830c8d 100644 --- a/mithril/mithril.d.ts +++ b/mithril/mithril.d.ts @@ -8,13 +8,13 @@ interface MithrilStatic { (selector: string, attributes: Object, children?: any): MithrilVirtualElement; (selector: string, children?: any): MithrilVirtualElement; - prop(value?: any): (value?: any) => any; + prop(value?: T): (value?: T) => T; withAttr(property: string, callback: (value: any) => void): (e: Event) => any; module(rootElement: Node, module: MithrilModule): void; trust(html: string): String; render(rootElement: Element, children?: any): void; render(rootElement: HTMLDocument, children?: any): void; - redraw(): void; + redraw: MithrilRedraw; route(rootElement: Element, defaultRoute: string, routes: { [key: string]: MithrilModule }): void; route(rootElement: HTMLDocument, defaultRoute: string, routes: { [key: string]: MithrilModule }): void; route(path: string, params?: any, shouldReplaceHistory?: boolean): void; @@ -27,6 +27,11 @@ interface MithrilStatic { endComputation(): void; } +interface MithrilRedraw { + (): void; + strategy: (value?: string) => string; +} + interface MithrilVirtualElement { tag: string; attrs: Object;