Remove useless generics, fix VirtualElement members, fix a few style issues

This commit is contained in:
impinball 2016-03-21 23:45:45 -04:00
parent fcf6e16929
commit 490a5c7b73

32
mithril.d.ts vendored
View file

@ -20,12 +20,10 @@ declare namespace Mithril {
* @see m.mount * @see m.mount
* @see m.component * @see m.component
*/ */
<T extends Controller>( (
selector: string, selector: string,
attributes: Attributes, attributes: Attributes,
...children: Array<string | ...children: Array<string | VirtualElement | Component<Controller>>
VirtualElement |
Component<T>>
): VirtualElement; ): VirtualElement;
/** /**
@ -56,11 +54,9 @@ declare namespace Mithril {
* @see m.mount * @see m.mount
* @see m.component * @see m.component
*/ */
<T extends Controller>( (
selector: string, selector: string,
...children: Array<string | ...children: Array<string | VirtualElement | Component<Controller>>
VirtualElement |
Component<T>>
): VirtualElement; ): VirtualElement;
/** /**
@ -193,7 +189,7 @@ declare namespace Mithril {
* @param forceRecreation If true, overwrite the entire tree without * @param forceRecreation If true, overwrite the entire tree without
* diffing against it. * diffing against it.
*/ */
render<T extends Controller>( render(
rootElement: Element, rootElement: Element,
children: VirtualElement|VirtualElement[], children: VirtualElement|VirtualElement[],
forceRecreation?: boolean forceRecreation?: boolean
@ -260,7 +256,7 @@ declare namespace Mithril {
* @param defaultRoute The route to start with. * @param defaultRoute The route to start with.
* @param routes A key-value mapping of pathname to controller. * @param routes A key-value mapping of pathname to controller.
*/ */
<T extends Controller>( (
rootElement: Element, rootElement: Element,
defaultRoute: string, defaultRoute: string,
routes: Routes routes: Routes
@ -276,7 +272,7 @@ declare namespace Mithril {
* m("a[href='/dashboard/alicesmith']", {config: m.route}); * m("a[href='/dashboard/alicesmith']", {config: m.route});
* ``` * ```
*/ */
<T extends Controller>( (
element: Element, element: Element,
isInitialized: boolean, isInitialized: boolean,
context?: Context, context?: Context,
@ -515,7 +511,7 @@ declare namespace Mithril {
* @param context The associated context for this element. * @param context The associated context for this element.
* @param vdom The associated virtual element. * @param vdom The associated virtual element.
*/ */
<T extends Controller>( (
element: Element, element: Element,
isInitialized: boolean, isInitialized: boolean,
context: Context, context: Context,
@ -583,7 +579,7 @@ declare namespace Mithril {
* @see ControllerFunction * @see ControllerFunction
*/ */
interface ControllerConstructor<T extends Controller> { interface ControllerConstructor<T extends Controller> {
new(): T; new (): T;
} }
/** /**
@ -608,8 +604,7 @@ declare namespace Mithril {
* *
* @see m.component * @see m.component
*/ */
controller: ControllerFunction<T> | controller: ControllerFunction<T> | ControllerConstructor<T>;
ControllerConstructor<T>;
/** /**
* Creates a view out of virtual elements. * Creates a view out of virtual elements.
@ -741,7 +736,7 @@ declare namespace Mithril {
interface Thennable<T> { interface Thennable<T> {
then<U>(success: (value: T) => U): Thennable<U>; then<U>(success: (value: T) => U): Thennable<U>;
then<U,V>(success: (value: T) => U, error: (value: Error) => V): Thennable<U>|Thennable<V>; then<U,V>(success: (value: T) => U, error: (value: Error) => V): Thennable<U>|Thennable<V>;
catch?: <U>(error: (value: Error) => U) => Thennable<U>; catch?<U>(error: (value: Error) => U): Thennable<U>;
} }
/** /**
@ -777,8 +772,7 @@ declare namespace Mithril {
* @param error The callback to call when the promise is rejected. * @param error The callback to call when the promise is rejected.
* @return The chained promise. * @return The chained promise.
*/ */
catch<U>(error: ErrorCallback<U>): Promise<T> | catch<U>(error: ErrorCallback<U>): Promise<T> | Promise<U>;
Promise<U>;
} }
/** /**
@ -918,7 +912,7 @@ declare namespace Mithril {
} }
} }
declare var m: Mithril.Static; declare const m: Mithril.Static;
declare module "mithril" { declare module "mithril" {
export = m; export = m;