@types/cli-table2 fixed header types

Though it is not currently documented, `head` prop accepts `Cell[]`, not
`string[]`.
I've made PR to cli-table2 regarding this
(https://github.com/jamestalmage/cli-table2/pull/53), but typings should
be fixed whether it is megred or not
This commit is contained in:
cornholio
2018-10-28 01:14:47 +03:00
parent 644c7b5909
commit 74102ab53d
2 changed files with 22 additions and 1 deletions
+21
View File
@@ -230,3 +230,24 @@ table26.push(
// feel free to use colors in your content strings, column widths will be calculated correctly
const table27 = new Table({ colWidths: [5], style: { head: [], border: [] } }) as Table.HorizontalTable;
table27.push([/*colors.red(*/'hello'/*)*/]);
// Header as text
const table28 = new Table({ head: ["Top Header 1", "Top Header 2"] }) as Table.HorizontalTable;
table28.push(
['Value Row 1 Col 1', 'Value Row 1 Col 2'],
['Value Row 2 Col 1', 'Value Row 2 Col 2']
);
// Header as Cells
const table29 = new Table({ head: [{content: "Top Header 1"}, {content: "Top Header 2"}] }) as Table.HorizontalTable;
table29.push(
['Value Row 1 Col 1', 'Value Row 1 Col 2'],
['Value Row 2 Col 1', 'Value Row 2 Col 2']
);
// ColSpan in header
const table30 = new Table({ head: [{content: "Top Header 1", colSpan: 2}, {content: "Top Header 3"}] }) as Table.HorizontalTable;
table30.push(
['Value Row 1 Col 1', 'Value Row 1 Col 2', 'Value Row 1 Col 3'],
['Value Row 2 Col 1', 'Value Row 2 Col 2', 'Value Row 2 Col 3']
);
+1 -1
View File
@@ -31,7 +31,7 @@ declare namespace CliTable2 {
rowHeights: Array<number | null>;
colAligns: HorizontalAlignment[];
rowAligns: VerticalAlignment[];
head: string[];
head: Cell[];
wordWrap: boolean;
}