Skip to main content

Type Alias: RenamedTableField<T>

RenamedTableField<T>: object

A renamed table field. A field with a label and a key of the object supplied to the table function.

Type Parameters

T

The type of the objects in the array in the table.

Type declaration

field

field: keyof T

label

label: string

Example

const items = [{name: 'Alice', age: 30}, {name: 'Bob', age: 40}];
console.log(table(items, [{label: 'Name', field: 'name'}, {label: 'Age', field: 'age'}]));
// Prints:
//
// | Name | Age |
// | ---- | --- |
// | Alice | 30 |
// | Bob | 40 |

Defined in

lib/markdown.ts:269