1 | # Installation
|
2 | > `npm install --save @types/cli-table`
|
3 |
|
4 | # Summary
|
5 | This package contains type definitions for cli-table (https://github.com/Automattic/cli-table).
|
6 |
|
7 | # Details
|
8 | Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cli-table.
|
9 | ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/cli-table/index.d.ts)
|
10 | ````ts
|
11 | // Type definitions for cli-table 0.3
|
12 | // Project: https://github.com/Automattic/cli-table
|
13 | // Definitions by: AryloYeung <https://github.com/arylo>
|
14 | // Antoni Spaanderman <https://github.com/antonilol>
|
15 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
16 | // TypeScript Version: 4.9
|
17 |
|
18 | type HorizontalTableRow = string[];
|
19 | type VerticalTableRow = Record<string, string>;
|
20 | type CrossTableRow = Record<string, string[]>;
|
21 | type TableRow = HorizontalTableRow | VerticalTableRow | CrossTableRow;
|
22 |
|
23 | interface TableOptions<T extends TableRow = TableRow> {
|
24 | rows?: T[];
|
25 | chars?: {
|
26 | [k in
|
27 | | 'top'
|
28 | | 'top-mid'
|
29 | | 'top-left'
|
30 | | 'top-right'
|
31 | | 'bottom'
|
32 | | 'bottom-mid'
|
33 | | 'bottom-left'
|
34 | | 'bottom-right'
|
35 | | 'left'
|
36 | | 'left-mid'
|
37 | | 'mid'
|
38 | | 'mid-mid'
|
39 | | 'right'
|
40 | | 'right-mid'
|
41 | | 'middle']?: string;
|
42 | };
|
43 | truncate?: string;
|
44 | colors?: boolean;
|
45 | colWidths?: number[];
|
46 | colAligns?: Array<'left' | 'middle' | 'right'>;
|
47 | style?: {
|
48 | 'padding-left'?: number;
|
49 | 'padding-right'?: number;
|
50 | head?: string[];
|
51 | border?: string[];
|
52 | compact?: boolean;
|
53 | };
|
54 | head?: string[];
|
55 | }
|
56 |
|
57 | declare class Table<T extends TableRow = TableRow> extends Array<T> {
|
58 | /**
|
59 | * Table constructor
|
60 | *
|
61 | * @param options
|
62 | * @api public
|
63 | */
|
64 | constructor(options?: T extends CrossTableRow ? never : TableOptions<T>);
|
65 | constructor(options: T extends CrossTableRow ? TableOptions<T> & { head: ['', ...string[]] } : never);
|
66 |
|
67 | /**
|
68 | * Width getter
|
69 | *
|
70 | * @return width
|
71 | * @api public
|
72 | */
|
73 | get width(): number;
|
74 |
|
75 | /**
|
76 | * Render to a string.
|
77 | *
|
78 | * @return table representation
|
79 | * @api public
|
80 | */
|
81 | render(): string;
|
82 |
|
83 | /**
|
84 | * Render to a string.
|
85 | *
|
86 | * @return table representation
|
87 | * @api public
|
88 | */
|
89 | toString(): string;
|
90 |
|
91 | static readonly version: string;
|
92 | }
|
93 |
|
94 | export = Table;
|
95 |
|
96 | ````
|
97 |
|
98 | ### Additional Details
|
99 | * Last updated: Tue, 27 Sep 2022 23:03:44 GMT
|
100 | * Dependencies: none
|
101 | * Global values: none
|
102 |
|
103 | # Credits
|
104 | These definitions were written by [AryloYeung](https://github.com/arylo), and [Antoni Spaanderman](https://github.com/antonilol).
|
105 |
|
\ | No newline at end of file |