-
Notifications
You must be signed in to change notification settings - Fork 4
/
each.d.ts
29 lines (27 loc) · 948 Bytes
/
each.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/// <reference types="mithril" />
import * as Mithril from "mithril";
/**
* Render a list by key.
*
* @param key A key selector function returning the key to use.
* @param child A function returning the child vnode to render.
* @returns A keyed fragment.
*/
export default function each<T>(
list: ArrayLike<T> | Iterable<T>,
by: (value: T, index: number) => PropertyKey,
child: (value: T, index: number) => Mithril.Children
): Mithril.Vnode<any, any>;
/**
* Render a list by key.
*
* @param key A property on each item representing the key to use.
* @param child A function returning the child vnode to render.
* @returns A keyed fragment.
*/
export default function each<T>(
list: ArrayLike<T> | Iterable<T>,
// Select keys whose values are property keys
by: {[P in keyof T]: T[P] extends PropertyKey ? P : never}[keyof T],
child: (value: T, index: number) => Mithril.Children
): Mithril.Vnode<any, any>;