Skip to content

[BUG] Can't create columns in typescript #1543

@Gennier

Description

@Gennier

🐛 Bug Report

I have created worksheet and using that worksheet i cant seems to create columns header.

const workbook = new Workbook();
workbook.creator = workbookName;

const worksheet = workbook.addWorksheet(workSheetName);
worksheet.columns = [
    { header: 'Id', key: 'id', width: 10 },
    { header: 'Name', key: 'name', width: 32 },
    { header: 'D.O.B.', key: 'DOB', width: 10, outlineLevel: 1 },
];

Error give.
Type '{ header: string; key: string; width: number; }' is missing the following properties from type 'Column': outlineLevel, hidden, style, values, and 11 more.

It just seems like under Type Columns all is required.

Lib version: 4.2.0

Steps To Reproduce

const workbook = new Workbook();
workbook.creator = workbookName;

const worksheet = workbook.addWorksheet(workSheetName);
worksheet.columns = [
    { header: 'Id', key: 'id', width: 10 },
    { header: 'Name', key: 'name', width: 32 },
    { header: 'D.O.B.', key: 'DOB', width: 10, outlineLevel: 1 },
];

The expected behaviour:

Type '{ header: string; key: string; width: number; }' is missing the following properties from type 'Column': outlineLevel, hidden, style, values, and 11 more.

Possible solution (optional, but very helpful):

Make fields in Type Columns optional

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions