Merge pull request #807 from mrtracy/next
Typescript: Make MithrilVirtualElement and MithrilRoutes non-generic
This commit is contained in:
commit
bf0890b255
1 changed files with 23 additions and 23 deletions
46
mithril.d.ts
vendored
46
mithril.d.ts
vendored
|
|
@ -20,13 +20,13 @@ declare module _mithril {
|
|||
* @see m.mount
|
||||
* @see m.component
|
||||
*/
|
||||
<T extends MithrilController>(
|
||||
(
|
||||
selector: string,
|
||||
attributes: MithrilAttributes,
|
||||
...children: Array<string |
|
||||
MithrilVirtualElement<T> |
|
||||
MithrilComponent<T>>
|
||||
): MithrilVirtualElement<T>;
|
||||
MithrilVirtualElement |
|
||||
MithrilComponent<MithrilController>>
|
||||
): MithrilVirtualElement;
|
||||
|
||||
/**
|
||||
* Creates a virtual element for use with m.render, m.mount, etc.
|
||||
|
|
@ -40,12 +40,12 @@ declare module _mithril {
|
|||
* @see m.mount
|
||||
* @see m.component
|
||||
*/
|
||||
<T extends MithrilController>(
|
||||
(
|
||||
selector: string,
|
||||
...children: Array<string |
|
||||
MithrilVirtualElement<T> |
|
||||
MithrilComponent<T>>
|
||||
): MithrilVirtualElement<T>;
|
||||
MithrilVirtualElement |
|
||||
MithrilComponent<MithrilController>>
|
||||
): MithrilVirtualElement;
|
||||
|
||||
/**
|
||||
* Initializes a component for use with m.render, m.mount, etc.
|
||||
|
|
@ -364,9 +364,9 @@ declare module _mithril {
|
|||
* @param forceRecreation If true, overwrite the entire tree without
|
||||
* diffing against it.
|
||||
*/
|
||||
render<T extends MithrilController>(
|
||||
render(
|
||||
rootElement: Element,
|
||||
children: MithrilVirtualElement<T>|MithrilVirtualElement<T>[],
|
||||
children: MithrilVirtualElement|MithrilVirtualElement[],
|
||||
forceRecreation?: boolean
|
||||
): void;
|
||||
|
||||
|
|
@ -431,10 +431,10 @@ declare module _mithril {
|
|||
* @param defaultRoute The route to start with.
|
||||
* @param routes A key-value mapping of pathname to controller.
|
||||
*/
|
||||
<T extends MithrilController>(
|
||||
(
|
||||
rootElement: Element,
|
||||
defaultRoute: string,
|
||||
routes: MithrilRoutes<T>
|
||||
routes: MithrilRoutes
|
||||
): void;
|
||||
|
||||
/**
|
||||
|
|
@ -447,11 +447,11 @@ declare module _mithril {
|
|||
* m("a[href='/dashboard/alicesmith']", {config: m.route});
|
||||
* ```
|
||||
*/
|
||||
<T extends MithrilController>(
|
||||
(
|
||||
element: Element,
|
||||
isInitialized: boolean,
|
||||
context?: MithrilContext,
|
||||
vdom?: MithrilVirtualElement<T>
|
||||
vdom?: MithrilVirtualElement
|
||||
): void;
|
||||
|
||||
/**
|
||||
|
|
@ -615,7 +615,7 @@ declare module _mithril {
|
|||
*
|
||||
* @see m
|
||||
*/
|
||||
interface MithrilVirtualElement<T extends MithrilController> {
|
||||
interface MithrilVirtualElement {
|
||||
/**
|
||||
* A key to optionally associate with this element.
|
||||
*/
|
||||
|
|
@ -634,7 +634,7 @@ declare module _mithril {
|
|||
/**
|
||||
* The children of this element.
|
||||
*/
|
||||
children?: Array<string|MithrilVirtualElement<T>|MithrilComponent<T>>;
|
||||
children?: Array<string|MithrilVirtualElement|MithrilComponent<MithrilController>>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -686,11 +686,11 @@ declare module _mithril {
|
|||
* @param context The associated context for this element.
|
||||
* @param vdom The associated virtual element.
|
||||
*/
|
||||
<T extends MithrilController>(
|
||||
(
|
||||
element: Element,
|
||||
isInitialized: boolean,
|
||||
context: MithrilContext,
|
||||
vdom: MithrilVirtualElement<T>
|
||||
vdom: MithrilVirtualElement
|
||||
): void;
|
||||
}
|
||||
|
||||
|
|
@ -758,7 +758,7 @@ declare module _mithril {
|
|||
/**
|
||||
* Creates a view out of virtual elements.
|
||||
*/
|
||||
(ctrl: T): MithrilVirtualElement<T>;
|
||||
(ctrl: T): MithrilVirtualElement;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -781,7 +781,7 @@ declare module _mithril {
|
|||
*
|
||||
* @see m.component
|
||||
*/
|
||||
view(ctrl: T): MithrilVirtualElement<T>;
|
||||
view(ctrl: T): MithrilVirtualElement;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -805,7 +805,7 @@ declare module _mithril {
|
|||
*
|
||||
* @see m.component
|
||||
*/
|
||||
view(ctrl: TController, arg1: T1, arg2: T2, arg3: T3, arg4: T4, ...args:any[]): MithrilVirtualElement<TController>;
|
||||
view(ctrl: TController, arg1: T1, arg2: T2, arg3: T3, arg4: T4, ...args:any[]): MithrilVirtualElement;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -876,12 +876,12 @@ declare module _mithril {
|
|||
/**
|
||||
* This represents a key-value mapping linking routes to components.
|
||||
*/
|
||||
interface MithrilRoutes<T extends MithrilController> {
|
||||
interface MithrilRoutes {
|
||||
/**
|
||||
* The key represents the route. The value represents the corresponding
|
||||
* component.
|
||||
*/
|
||||
[key: string]: MithrilComponent<T>;
|
||||
[key: string]: MithrilComponent<MithrilController>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue