Skip to content

Commit a682091

Browse files
authored
Merge pull request #1488 from nywleswoey/refine-column-typing
Refine typing for Column
2 parents 819b09c + 028d757 commit a682091

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

index.d.ts

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -602,17 +602,17 @@ export interface Column {
602602
/**
603603
* Can be a string to set one row high header or an array to set multi-row high header
604604
*/
605-
header: string | string[];
605+
header?: string | string[];
606606

607607
/**
608608
* The name of the properties associated with this column in each row
609609
*/
610-
key: string;
610+
key?: string;
611611

612612
/**
613613
* The width of the column
614614
*/
615-
width: number;
615+
width?: number;
616616

617617
/**
618618
* Set an outline level for columns
@@ -644,12 +644,16 @@ export interface Column {
644644
readonly headers: string[];
645645
readonly isDefault: boolean;
646646
readonly headerCount: number;
647-
border: Partial<Borders>;
648-
fill: Fill;
649-
numFmt: string
650-
font: Partial<Font>;
651-
alignment: Partial<Alignment>;
652-
protection: Partial<Protection>;
647+
648+
/**
649+
* Below properties read from style
650+
*/
651+
border?: Partial<Borders>;
652+
fill?: Fill;
653+
numFmt?: string;
654+
font?: Partial<Font>;
655+
alignment?: Partial<Alignment>;
656+
protection?: Partial<Protection>;
653657

654658
toString(): string
655659
equivalentTo(other: Column): boolean
@@ -1137,18 +1141,18 @@ export interface Worksheet {
11371141
*/
11381142
readonly actualColumnCount: number;
11391143

1140-
getColumnKey(key: string): Partial<Column>;
1144+
getColumnKey(key: string): Column;
11411145

1142-
setColumnKey(key: string, value: Partial<Column>): void;
1146+
setColumnKey(key: string, value: Column): void;
11431147

11441148
deleteColumnKey(key: string): void;
11451149

1146-
eachColumnKey(callback: (col: Partial<Column>, index: number) => void): void;
1150+
eachColumnKey(callback: (col: Column, index: number) => void): void;
11471151

11481152
/**
11491153
* Access an individual columns by key, letter and 1-based column number
11501154
*/
1151-
getColumn(indexOrKey: number | string): Partial<Column>;
1155+
getColumn(indexOrKey: number | string): Column;
11521156

11531157
/**
11541158
* Cut one or more columns (columns to the right are shifted left)
@@ -1169,7 +1173,7 @@ export interface Worksheet {
11691173
* Note: these column structures are a workbook-building convenience only,
11701174
* apart from the column width, they will not be fully persisted.
11711175
*/
1172-
columns: Array<Partial<Column>>;
1176+
columns: Array<Column>;
11731177

11741178
/**
11751179
* The total row size of the document. Equal to the row number of the last row that has values.

0 commit comments

Comments
 (0)