Skip to content

Commit

Permalink
Merge pull request exceljs#1488 from nywleswoey/refine-column-typing
Browse files Browse the repository at this point in the history
Refine typing for Column
  • Loading branch information
alubbe authored Oct 5, 2020
2 parents 819b09c + 028d757 commit a682091
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,17 +602,17 @@ export interface Column {
/**
* Can be a string to set one row high header or an array to set multi-row high header
*/
header: string | string[];
header?: string | string[];

/**
* The name of the properties associated with this column in each row
*/
key: string;
key?: string;

/**
* The width of the column
*/
width: number;
width?: number;

/**
* Set an outline level for columns
Expand Down Expand Up @@ -644,12 +644,16 @@ export interface Column {
readonly headers: string[];
readonly isDefault: boolean;
readonly headerCount: number;
border: Partial<Borders>;
fill: Fill;
numFmt: string
font: Partial<Font>;
alignment: Partial<Alignment>;
protection: Partial<Protection>;

/**
* Below properties read from style
*/
border?: Partial<Borders>;
fill?: Fill;
numFmt?: string;
font?: Partial<Font>;
alignment?: Partial<Alignment>;
protection?: Partial<Protection>;

toString(): string
equivalentTo(other: Column): boolean
Expand Down Expand Up @@ -1137,18 +1141,18 @@ export interface Worksheet {
*/
readonly actualColumnCount: number;

getColumnKey(key: string): Partial<Column>;
getColumnKey(key: string): Column;

setColumnKey(key: string, value: Partial<Column>): void;
setColumnKey(key: string, value: Column): void;

deleteColumnKey(key: string): void;

eachColumnKey(callback: (col: Partial<Column>, index: number) => void): void;
eachColumnKey(callback: (col: Column, index: number) => void): void;

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

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

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

0 comments on commit a682091

Please sign in to comment.